small adjustments to Makefile and gitignore

This commit is contained in:
Andrej Karpathy 2024-04-21 17:40:26 +00:00
parent e70bc19af5
commit fced6d180f
2 changed files with 22 additions and 7 deletions

15
.gitignore vendored
View file

@ -1,9 +1,24 @@
# dot files and such
.vscode/
# data files
data/
# .bin files generated by Python
gpt2_124M.bin
gpt2_124M_debug_state.bin
gpt2_tokenizer.bin
# binaries
test_gpt2
test_gpt2cu
train_gpt2
train_gpt2cu
dev/cuda/*_forward
dev/cuda/*_backward
dev/cuda/classifier_fused
dev/cuda/adamw
dev/cuda/matmul_backward_bias
# log files
*.log

View file

@ -37,24 +37,24 @@ ifeq ($(shell uname), Darwin)
LDFLAGS += -L/opt/homebrew/opt/libomp/lib
LDLIBS += -lomp
INCLUDES += -I/opt/homebrew/opt/libomp/include
$(info NICE Compiling with OpenMP support)
$(info OpenMP found, compiling with OpenMP support)
else ifeq ($(shell [ -d /usr/local/opt/libomp/lib ] && echo "exists"), exists)
CFLAGS += -Xclang -fopenmp -DOMP
LDFLAGS += -L/usr/local/opt/libomp/lib
LDLIBS += -lomp
INCLUDES += -I/usr/local/opt/libomp/include
$(info NICE Compiling with OpenMP support)
$(info OpenMP found, compiling with OpenMP support)
else
$(warning OOPS Compiling without OpenMP support)
$(warning OpenMP not found, skipping OpenMP support)
endif
else
ifeq ($(shell echo | $(CC) -fopenmp -x c -E - > /dev/null 2>&1; echo $$?), 0)
# Ubuntu or other Linux distributions
CFLAGS += -fopenmp -DOMP
LDLIBS += -lgomp
$(info NICE Compiling with OpenMP support)
$(info OpenMP found, compiling with OpenMP support)
else
$(warning OOPS Compiling without OpenMP support)
$(warning OpenMP not found, skipping OpenMP support)
endif
endif
@ -66,9 +66,9 @@ TARGETS = train_gpt2 test_gpt2
# Conditional inclusion of CUDA targets
ifeq ($(NVCC),)
$(info nvcc not found, skipping CUDA build)
$(info nvcc not found, skipping CUDA builds)
else
$(info nvcc found, including CUDA build)
$(info nvcc found, including CUDA builds)
TARGETS += train_gpt2cu test_gpt2cu
endif