Skip to content

Commit

Permalink
Avoid race condition in makefile that will generate .dep.mk twice und…
Browse files Browse the repository at this point in the history
…er ./lib/nnc/gpu
  • Loading branch information
liuliu committed Jun 10, 2024
1 parent 0d6d387 commit 499bb91
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/analyze.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
cd lib && ./configure --enable-sm80 --disable-openmp && cd ..
- name: analyze
run: |
cd lib && scan-build -o ../_analyze --use-cc clang make -j 32
cd lib && scan-build -o ../_analyze --use-cc clang make -j 64
- name: upload report
run: |
cd _analyze
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: configure & build
run: |
cd lib && ./configure --enable-sm80 && cd ..
make -j 32 -C test COVER=1 all.tests
make -j 64 -C test COVER=1 all.tests
- name: tests
run: |
make -C test check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cuda-int-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: configure & build
run: |
cd lib && ./configure --enable-sm80 && cd ..
make -j 32 -C test/int/nnc
make -j 64 -C test/int/nnc
- name: integration tests
run: |
make -C test/int/nnc test
10 changes: 5 additions & 5 deletions .github/workflows/ubsan-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
- name: configure & build
run: |
cd lib && ./configure --enable-sm80 && cd ..
make -j 32 -C lib ubsan
make -j 32 -C bin ubsan
make -j 32 -C bin/nnc ubsan
make -j 32 -C bin/cuda ubsan
make -j 32 -C test ubsan
make -j 64 -C lib ubsan
make -j 64 -C bin ubsan
make -j 64 -C bin/nnc ubsan
make -j 64 -C bin/cuda ubsan
make -j 64 -C test ubsan
- name: tests
run: |
make -C test test
2 changes: 1 addition & 1 deletion lib/configure
Original file line number Diff line number Diff line change
Expand Up @@ -4641,7 +4641,7 @@ fi
printf "%s\n" "yes" >&6; }
DEFINE_MACROS="$DEFINE_MACROS-D HAVE_CUDA_SM80 "
CUDA_COMPAT_SM80_LIB="gpu/libnnc-compat-cuda-sm80.o"
CUDA_COMPAT_SM80_LIB="libnnc-compat-cuda-sm80.o"
NV_SM_FLAGS="-arch=sm_80 -std=c++17 --expt-relaxed-constexpr"
Expand Down
2 changes: 1 addition & 1 deletion lib/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ if [[ -d "$cuda_prefix" ]]; then
if test "$sm80_support" = yes; then
AC_MSG_RESULT(yes)
AC_SUBST(DEFINE_MACROS, ["$DEFINE_MACROS-D HAVE_CUDA_SM80 "])
AC_SUBST(CUDA_COMPAT_SM80_LIB, ["gpu/libnnc-compat-cuda-sm80.o"])
AC_SUBST(CUDA_COMPAT_SM80_LIB, ["libnnc-compat-cuda-sm80.o"])
AC_SUBST(NV_SM_FLAGS, ["-arch=sm_80 -std=c++17 --expt-relaxed-constexpr"])
else
AC_MSG_RESULT(no)
Expand Down
2 changes: 1 addition & 1 deletion lib/nnc/gpu/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ lib: libnnc-compat-cuda.o
clean:
rm -f *.o

libnnc-compat-cuda.o: $(SRC_OBJS)
libnnc-compat-cuda.o: $(SRC_OBJS) $(CUDA_COMPAT_SM80_LIB)
ld -r $^ -o $@

libnnc-compat-cuda-sm80.o: $(FLASH_ATTN_SRC_OBJS)
Expand Down
7 changes: 2 additions & 5 deletions lib/nnc/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SRCS := ccv_nnc_cmd.c ccv_nnc_tensor.c ccv_nnc_tensor_io.c ccv_nnc_stream.c ccv_

SRC_OBJS := $(patsubst %.c,%.o,$(SRCS))

.PHONY: release all lib clean cmd libnnc.o cmd/libnnc-cmd.o gpu/libnnc-compat-cuda.o gpu/libnnc-compat-cuda-sm80.o mfa/libnnc-compat-mfa.o mps/libnnc-compat-mps.o
.PHONY: release all lib clean cmd libnnc.o cmd/libnnc-cmd.o gpu/libnnc-compat-cuda.o mfa/libnnc-compat-mfa.o mps/libnnc-compat-mps.o

release: all

Expand All @@ -20,7 +20,7 @@ lib: libnnc.o
clean:
${MAKE} -C ./cmd clean ; ${MAKE} -C ./gpu clean ; ${MAKE} -C ./mfa clean ; ${MAKE} -C ./mps clean ; rm -f *.o gpu/*.o

libnnc.o: $(SRC_OBJS) cmd/libnnc-cmd.o $(CUDA_COMPAT_LIB) $(CUDA_COMPAT_SM80_LIB) $(MFA_COMPAT_LIB) $(MPS_COMPAT_LIB)
libnnc.o: $(SRC_OBJS) cmd/libnnc-cmd.o $(CUDA_COMPAT_LIB) $(MFA_COMPAT_LIB) $(MPS_COMPAT_LIB)
ld -r $^ -o $@

%.o: %.c
Expand All @@ -38,9 +38,6 @@ cmd:
gpu/libnnc-compat-cuda.o:
${MAKE} -C ./gpu

gpu/libnnc-compat-cuda-sm80.o:
${MAKE} -C ./gpu libnnc-compat-cuda-sm80.o

mfa/libnnc-compat-mfa.o:
${MAKE} -C ./mfa

Expand Down

0 comments on commit 499bb91

Please sign in to comment.