Skip to content

Commit

Permalink
Merge branch 'master' into py-tqdm
Browse files Browse the repository at this point in the history
  • Loading branch information
karpathy authored Apr 8, 2024
2 parents 8465847 + 40221cc commit 90ac963
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ INCLUDES =
# e.g. on MacOS: brew install libomp
# e.g. on Ubuntu: sudo apt-get install libomp-dev
# later, run the program by prepending the number of threads, e.g.: OMP_NUM_THREADS=8 ./gpt2
ifeq ($(shell echo | $(CC) -Xpreprocessor -fopenmp -x c -E - > /dev/null 2>&1; echo $$?), 0)
ifeq ($(shell echo | $(CC) -fopenmp -x c -E - > /dev/null 2>&1; echo $$?), 0)
ifeq ($(shell uname), Darwin)
# macOS with Homebrew
CFLAGS += -Xclang -fopenmp
CFLAGS += -Xclang -fopenmp -DOMP
LDFLAGS += -L/opt/homebrew/opt/libomp/lib
LDLIBS += -lomp
INCLUDES += -I/opt/homebrew/opt/libomp/include
else
# Ubuntu or other Linux distributions
CFLAGS += -fopenmp
CFLAGS += -fopenmp -DOMP
LDLIBS += -lgomp
endif
$(info NICE Compiling with OpenMP support)
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tqdm
numpy
torch
tiktoken
tqdm
transformers
4 changes: 3 additions & 1 deletion train_gpt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ There will be other versions of this code that specialize it and make it fast.
#include <time.h>
#include <string.h>
#include <unistd.h>
#ifdef OMP
#include <omp.h>
#endif

// ----------------------------------------------------------------------------
// all the individual layers' forward and backward passes
Expand Down Expand Up @@ -1121,4 +1123,4 @@ int main() {
gpt2_free(&model);
return 0;
}
#endif
#endif

0 comments on commit 90ac963

Please sign in to comment.