-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
68 lines (50 loc) · 1.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
SHELL := /bin/bash
BUILD_DIR := ./bin
CUDA_SRC_DIR := ./kernels
C_SRC_DIR := ./csrc
CHPL_MODULES_DIR := ./modules
CUDA_PATH := $(CUDA_HOME)
CUDA_INCLUDE_DIR := $(CUDA_PATH)/include
CUDA_LIB_DIR := $(CUDA_PATH)/lib
LIBRARY_DIR := ./libs
C_SOURCES := $(shell find $(C_SRC_DIR) -name '*.c')
AMD_DIR := /opt/rocm/
CHPL_DEBUG_FLAGS = -s queens_checkPointer=false -s avoidMirrored=true -s timeDistributedIters=true -s infoDistributedIters=true -s CPUGPUVerbose=false
chapelcuda: cuda dir
@echo
@echo " ### Building the Chapel-CUDA code... ### "
@echo
chpl -s GPUCUDA=true -s GPUAMD=false -L$(LIBRARY_DIR) -lqueens -lutil -M $(CHPL_MODULES_DIR) --fast $(CHPL_DEBUG_FLAGS) main.chpl -o $(BUILD_DIR)/chop.out
@echo
@echo " ### Compilation done ### "
$(shell sh ./ncomp.sh)
chapelamd: amd dir
@echo
@echo " ### Building the Chapel-AMD code... ### "
@echo
chpl -s GPUAMD=true -s GPUCUDA=false -I$(AMD_DIR)/include/ -L$(LIBRARY_DIR) -lamdqueens -L$(AMD_DIR)/lib/ -lamdhip64 -M $(CHPL_MODULES_DIR) --fast $(CHPL_DEBUG_FLAGS) main.chpl -o $(BUILD_DIR)/chop.out
@echo
@echo " ### Compilation done ### "
$(shell sh ./ncomp.sh)
cuda: dir
@echo
@echo " ### starting CUDA compilation ### "
@echo
$(CUDA_PATH)/bin/nvcc --shared -o $(LIBRARY_DIR)/libqueens.so $(CUDA_SRC_DIR)/CUDA_queens_kernels.cu --compiler-options '-fPIC -O3' -I$(CUDA_INCLUDE_DIR) -L$(CUDA_LIB_DIR) -lcudart
$(CUDA_PATH)/bin/nvcc --shared -o $(LIBRARY_DIR)/libutil.so $(CUDA_SRC_DIR)/GPU_aux.cu --compiler-options '-fPIC -O3' -I$(CUDA_INCLUDE_DIR) -L$(CUDA_LIB_DIR) -lcudart
amd: dir
@echo
@echo " ### starting AMD compilation ### "
@echo
hipcc -O3 -DHIP_FAST_MATH -D__HIP_PLATFORM_AMD__ $(CUDA_SRC_DIR)/AMD_queens_kernels.hip --emit-static-lib -fPIC -o $(LIBRARY_DIR)/libamdqueens.a
dir:
@echo
@echo " ### creating directories ### "
@echo
mkdir -p $(LIBRARY_DIR)
mkdir -p $(BUILD_DIR)
.PHONY: clean
clean:
$(RM) $(LIBRARY_DIR)/*.so
$(RM) $(BUILD_DIR)/chop.out
$(RM) $(BUILD_DIR)/chop.out_real