Skip to content

Commit

Permalink
move '-x cu' into arch files
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Knight committed Feb 26, 2025
1 parent 0ea1f49 commit 22ae67c
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 15 deletions.
3 changes: 2 additions & 1 deletion gpu/mini-apps/affinity/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ $(C_OBJ): %.o: %.cpp
$(CXX) $(CXXFLAGS) -c $<

$(CUDA_OBJ): %.o: pm/%.cpp
$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@
$(CUDA_CXX) $(CUDA_CXXFLAGS) -c $< -o $@
#$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@

$(PM_OBJ): %.o: pm/%.cpp
$(CXX) $(CXXFLAGS) -c $<
Expand Down
3 changes: 2 additions & 1 deletion gpu/mini-apps/math/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ $(C_OBJ): %.o: %.cpp
$(CXX) $(CXXFLAGS) -c $<

$(CUDA_OBJ): %.o: pm/%.cpp
$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@
$(CUDA_CXX) $(CUDA_CXXFLAGS) -c $< -o $@
#$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@

$(PM_OBJ): %.o: pm/%.cpp
$(CXX) $(CXXFLAGS) -c $<
Expand Down
31 changes: 22 additions & 9 deletions gpu/mini-apps/transpose/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ CUDA_OBJ2 = $(TMP02:.cpp=.o)
CUDA_OBJ = $(CUDA_OBJ1) $(CUDA_OBJ2)

# -- subset of src files in src directory
C_SRC = $(wildcard *.cpp)
C_SRC1 = $(wildcard *.cpp)
C_SRC2 = $(filter-out $(CUDA_SRC2), $(wildcard offload/*.cpp))
C_SRC = $(C_SRC1) $(C_SRC2)
C_INC = $(wildcard *.h)
C_OBJ = $(C_SRC:.cpp=.o)
C_OBJ1 = $(C_SRC1:.cpp=.o)
TMP03 = $(C_SRC2:offload/%=%)
C_OBJ2 = $(TMP03:.cpp=.o)
C_OBJ = $(C_OBJ1) $(C_OBJ2)

# -- subset of src files in src/pm directory
PM_SRC = $(filter-out $(CUDA_SRC), $(wildcard pm/*.cpp))
Expand All @@ -48,9 +53,9 @@ $(info CUDA_SRC is [${CUDA_SRC}])
$(info CUDA_INC is [${CUDA_INC}])
$(info CUDA_OBJ is [${CUDA_OBJ}])

#$(info C_SRC is [${C_SRC}])
#$(info C_INC is [${C_INC}])
#$(info C_OBJ is [${C_OBJ}])
$(info C_SRC is [${C_SRC}])
$(info C_INC is [${C_INC}])
$(info C_OBJ is [${C_OBJ}])

#$(info PM_SRC is [${PM_SRC}])
#$(info PM_INC is [${PM_INC}])
Expand All @@ -67,14 +72,19 @@ update:

####################################################################

$(C_OBJ): %.o: %.cpp
$(C_OBJ1): %.o: %.cpp
$(CXX) $(CXXFLAGS) -c $<

$(C_OBJ2): %.o: offload/%.cpp
$(CXX) $(CXXFLAGS) -c $<

$(CUDA_OBJ1): %.o: pm/%.cpp
$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@
$(CUDA_CXX) $(CUDA_CXXFLAGS) -c $< -o $@
#$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@

$(CUDA_OBJ2): %.o: offload/%.cpp
$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@
$(CUDA_CXX) $(CUDA_CXXFLAGS) -c $< -o $@
#$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@

$(PM_OBJ): %.o: pm/%.cpp
$(CXX) $(CXXFLAGS) -c $<
Expand All @@ -92,7 +102,7 @@ realclean:
rm -f $(EXE)
rm -rf $(EXE).dSYM
rm -f *.optrpt
rm -r pm
rm -rf pm

#
# -- Simple dependencies
Expand All @@ -102,3 +112,6 @@ pm_sycl.o : pm/pm_sycl.cpp pm/pm_sycl.h pm/pm.h
pm_hip.o : pm/pm_hip.cpp pm/pm_hip.h pm/pm.h
pm_openmp.o : pm/pm_openmp.cpp pm/pm_openmp.h pm/pm.h
pm_host.o : pm/pm_host.cpp pm/pm_host.h pm/pm.h

offload_cuda.o : offload/offload_cuda.cpp
offload_sycy.o : offload/offload_sycl.cpp
3 changes: 2 additions & 1 deletion gpu/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ $(ML_OBJ): %.o: mathlib/%.cpp
$(CXX) $(CXXFLAGS) -c $<

$(CUDA_OBJ): %.o: pm/%.cpp
$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@
$(CUDA_CXX) $(CUDA_CXXFLAGS) -c $< -o $@
#$(CUDA_CXX) -x cu $(CUDA_CXXFLAGS) -c $< -o $@

#
# -- Remove *.o and *~ from the directory
Expand Down
2 changes: 1 addition & 1 deletion gpu/src/arch/midway
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CXXFLAGS += -I$(CUDA_HOME)/include
CXXFLAGS += -D_USE_NVTX

CUDA_CXX = nvcc
CUDA_CXXFLAGS = $(PYTHON_INC)
CUDA_CXXFLAGS = -x cu $(PYTHON_INC)
CUDA_CXXFLAGS += -arch=sm_37
CUDA_CXXFLAGS += -Xcompiler -fopenmp
#CUDA_CXXFLAGS += -shared -Xcompiler -fPIC
Expand Down
2 changes: 1 addition & 1 deletion gpu/src/arch/polaris-gnu-nvcc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CXXFLAGS += -D_SIMPLE_TIMER
CXXFLAGS += -D_USE_NVTX

CUDA_CXX = nvcc
CUDA_CXXFLAGS = $(PYTHON_INC)
CUDA_CXXFLAGS = -x cu $(PYTHON_INC)
#CUDA_CXXFLAGS += --dryrun
CUDA_CXXFLAGS += -ccbin=CC
CUDA_CXXFLAGS += -Xcompiler -fopenmp
Expand Down
2 changes: 1 addition & 1 deletion gpu/src/arch/sophia-gnu-nvcc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CXXFLAGS += -D_SIMPLE_TIMER
CXXFLAGS += -D_USE_NVTX

CUDA_CXX = nvcc
CUDA_CXXFLAGS = $(PYTHON_INC)
CUDA_CXXFLAGS = -x cu $(PYTHON_INC)
CUDA_CXXFLAGS += -ccbin=mpicxx -arch=sm_80
CUDA_CXXFLAGS += -Xcompiler -fopenmp
CUDA_CXXFLAGS += -D_USE_GPU -D_GPU_CUDA -D_GPU_CUBLAS
Expand Down

0 comments on commit 22ae67c

Please sign in to comment.