Merge pull request #79 from tom91136/master
Update build flags for SYCL, Kokkos, and OpenMP, tracking newest versions of each compiler
This commit is contained in:
commit
17f057c38a
10
Kokkos.make
10
Kokkos.make
@ -5,7 +5,7 @@ ifndef DEVICE
|
|||||||
define device_help
|
define device_help
|
||||||
Set DEVICE to change flags (defaulting to OpenMP).
|
Set DEVICE to change flags (defaulting to OpenMP).
|
||||||
Available devices are:
|
Available devices are:
|
||||||
OpenMP, Serial, Pthreads, Cuda
|
OpenMP, Serial, Pthreads, Cuda, HIP
|
||||||
|
|
||||||
endef
|
endef
|
||||||
$(info $(device_help))
|
$(info $(device_help))
|
||||||
@ -36,7 +36,9 @@ ifndef COMPILER
|
|||||||
define compiler_help
|
define compiler_help
|
||||||
Set COMPILER to change flags (defaulting to GNU).
|
Set COMPILER to change flags (defaulting to GNU).
|
||||||
Available compilers are:
|
Available compilers are:
|
||||||
GNU INTEL CRAY PGI ARMCLANG
|
GNU INTEL CRAY PGI ARMCLANG HIPCC
|
||||||
|
|
||||||
|
Note: you may have to do `export CXX=\path\to\hipcc` in case Kokkos detects the wrong compiler
|
||||||
|
|
||||||
endef
|
endef
|
||||||
$(info $(compiler_help))
|
$(info $(compiler_help))
|
||||||
@ -44,6 +46,7 @@ COMPILER=GNU
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
COMPILER_ARMCLANG = armclang++
|
COMPILER_ARMCLANG = armclang++
|
||||||
|
COMPILER_HIPCC = hipcc
|
||||||
COMPILER_GNU = g++
|
COMPILER_GNU = g++
|
||||||
COMPILER_INTEL = icpc -qopt-streaming-stores=always
|
COMPILER_INTEL = icpc -qopt-streaming-stores=always
|
||||||
COMPILER_CRAY = CC
|
COMPILER_CRAY = CC
|
||||||
@ -56,14 +59,17 @@ Set TARGET to change to offload device. Defaulting to CPU.
|
|||||||
Available targets are:
|
Available targets are:
|
||||||
CPU (default)
|
CPU (default)
|
||||||
GPU
|
GPU
|
||||||
|
|
||||||
endef
|
endef
|
||||||
$(info $(target_help))
|
$(info $(target_help))
|
||||||
TARGET=CPU
|
TARGET=CPU
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET), GPU)
|
ifeq ($(TARGET), GPU)
|
||||||
|
ifneq ($(COMPILER), HIPCC)
|
||||||
CXX = $(NVCC_WRAPPER)
|
CXX = $(NVCC_WRAPPER)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
OBJ = main.o KokkosStream.o
|
OBJ = main.o KokkosStream.o
|
||||||
CXXFLAGS = -O3
|
CXXFLAGS = -O3
|
||||||
|
|||||||
@ -16,7 +16,7 @@ ifndef TARGET
|
|||||||
define target_help
|
define target_help
|
||||||
Set TARGET to change device (defaulting to CPU).
|
Set TARGET to change device (defaulting to CPU).
|
||||||
Available targets are:
|
Available targets are:
|
||||||
CPU NVIDIA AMD
|
CPU NVIDIA AMD INTEL_GPU
|
||||||
|
|
||||||
endef
|
endef
|
||||||
$(info $(target_help))
|
$(info $(target_help))
|
||||||
@ -36,7 +36,7 @@ CXX = $(COMPILER_$(COMPILER))
|
|||||||
|
|
||||||
FLAGS_GNU = -O3 -std=c++11 -march=native
|
FLAGS_GNU = -O3 -std=c++11 -march=native
|
||||||
FLAGS_GNU_PPC = -O3 -std=c++11 -mcpu=native
|
FLAGS_GNU_PPC = -O3 -std=c++11 -mcpu=native
|
||||||
FLAGS_INTEL = -O3 -std=c++11 -xHOST -qopt-streaming-stores=always
|
FLAGS_INTEL = -O3 -std=c++11
|
||||||
FLAGS_CRAY = -O3 -std=c++11
|
FLAGS_CRAY = -O3 -std=c++11
|
||||||
FLAGS_CLANG = -O3 -std=c++11
|
FLAGS_CLANG = -O3 -std=c++11
|
||||||
FLAGS_XL = -O5 -qarch=auto -qtune=auto -std=c++11
|
FLAGS_XL = -O5 -qarch=auto -qtune=auto -std=c++11
|
||||||
@ -61,6 +61,9 @@ OMP_CLANG_NVIDIA = -DOMP_TARGET_GPU -fopenmp=libomp -fopenmp-targets=nvptx64-nvi
|
|||||||
OMP_GNU_NVIDIA = -DOMP_TARGET_GPU -fopenmp -foffload=nvptx-none
|
OMP_GNU_NVIDIA = -DOMP_TARGET_GPU -fopenmp -foffload=nvptx-none
|
||||||
OMP_GNU_AMD = -DOMP_TARGET_GPU -fopenmp -foffload=amdgcn-amdhsa
|
OMP_GNU_AMD = -DOMP_TARGET_GPU -fopenmp -foffload=amdgcn-amdhsa
|
||||||
|
|
||||||
|
OMP_INTEL_CPU = -xHOST -qopt-streaming-stores=always
|
||||||
|
OMP_INTEL_INTEL_GPU = -DOMP_TARGET_GPU -qnextgen -fiopenmp -fopenmp-targets=spir64
|
||||||
|
|
||||||
ifndef OMP_$(COMPILER)_$(TARGET)
|
ifndef OMP_$(COMPILER)_$(TARGET)
|
||||||
$(error Targeting $(TARGET) with $(COMPILER) not supported)
|
$(error Targeting $(TARGET) with $(COMPILER) not supported)
|
||||||
endif
|
endif
|
||||||
|
|||||||
94
SYCL.make
94
SYCL.make
@ -1,17 +1,97 @@
|
|||||||
|
ifndef COMPILER
|
||||||
|
define compiler_help
|
||||||
|
Set COMPILER to change flags (defaulting to GNU).
|
||||||
|
Available compilers are:
|
||||||
|
HIPSYCL, DPCPP, COMPUTECPP
|
||||||
|
|
||||||
|
|
||||||
COMPUTECPP_FLAGS = $(shell $(COMPUTECPP_PACKAGE_ROOT_DIR)/bin/computecpp_info --dump-device-compiler-flags)
|
For HIPSYCL and COMPUTECPP, SYCL_SDK_DIR must be specified, the directory should contain [/lib, /bin, ...]
|
||||||
|
For DPCPP, the compiler must be on path
|
||||||
|
endef
|
||||||
|
$(info $(compiler_help))
|
||||||
|
COMPILER=HIPSYCL
|
||||||
|
endif
|
||||||
|
|
||||||
sycl-stream: main.o SYCLStream.o SYCLStream.sycl
|
ifndef TARGET
|
||||||
$(CXX) -O3 -std=c++11 -DSYCL main.o SYCLStream.o $(EXTRA_FLAGS) -L$(COMPUTECPP_PACKAGE_ROOT_DIR)/lib -lComputeCpp -lOpenCL -Wl,--rpath=$(COMPUTECPP_PACKAGE_ROOT_DIR)/lib/ -o $@
|
define target_help
|
||||||
|
Set TARGET to change device (defaulting to CPU).
|
||||||
|
Available targets are:
|
||||||
|
CPU AMD NVIDIA
|
||||||
|
|
||||||
|
endef
|
||||||
|
$(info $(target_help))
|
||||||
|
TARGET=CPU
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifndef ARCH
|
||||||
|
define arch_help
|
||||||
|
Set ARCH to change device (defaulting to "").
|
||||||
|
(GPU *only*) Available targets for HIPSYCL are:
|
||||||
|
For CUDA, the architecture has the form sm_XX, e.g. sm_60 for Pascal.
|
||||||
|
For ROCm, the architecture has the form gfxYYY, e.g. gfx900 for Vega 10, gfx906 for Vega 20.
|
||||||
|
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifneq ($(COMPILER), DPCPP)
|
||||||
|
$(info $(arch_help))
|
||||||
|
ARCH=
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
SYCL_COMPUTECPP_SYCLFLAGS = $(shell $(SYCL_SDK_DIR)/bin/computecpp_info --dump-device-compiler-flags)
|
||||||
|
SYCL_COMPUTECPP_SYCLFLAGS_AMD = $(SYCL_COMPUTECPP_SYCLFLAGS)
|
||||||
|
SYCL_COMPUTECPP_SYCLFLAGS_CPU = $(SYCL_COMPUTECPP_SYCLFLAGS)
|
||||||
|
SYCL_COMPUTECPP_SYCLFLAGS_NVIDIA = $(SYCL_COMPUTECPP_SYCLFLAGS) -sycl-target ptx64
|
||||||
|
SYCL_COMPUTECPP_SYCLCXX = $(SYCL_SDK_DIR)/bin/compute++
|
||||||
|
SYCL_COMPUTECPP_FLAGS = -O3 --std=c++17
|
||||||
|
SYCL_COMPUTECPP_LINK_FLAGS = -L$(SYCL_SDK_DIR)/lib -lComputeCpp -lOpenCL -Wl,--rpath=$(SYCL_SDK_DIR)/lib/
|
||||||
|
SYCL_COMPUTECPP_INCLUDE = -I$(SYCL_SDK_DIR)/include
|
||||||
|
SYCL_COMPUTECPP_CXX = g++
|
||||||
|
SYCL_COMPUTECPP_DEPS = SYCLStream.sycl
|
||||||
|
|
||||||
|
SYCL_HIPSYCL_SYCLFLAGS_CPU = -O3 --std=c++17 --hipsycl-platform=cpu
|
||||||
|
SYCL_HIPSYCL_SYCLFLAGS_AMD = -O3 --std=c++17 --hipsycl-platform=rocm --hipsycl-gpu-arch=$(ARCH)
|
||||||
|
SYCL_HIPSYCL_SYCLFLAGS_NVIDIA = -O3 --std=c++17 --hipsycl-platform=cuda --hipsycl-gpu-arch=$(ARCH)
|
||||||
|
SYCL_HIPSYCL_SYCLCXX = $(SYCL_SDK_DIR)/bin/syclcc
|
||||||
|
SYCL_HIPSYCL_FLAGS = $(SYCL_HIPSYCL_SYCLFLAGS_$(TARGET))
|
||||||
|
SYCL_HIPSYCL_LINK_FLAGS = -L$(SYCL_SDK_DIR)/lib -Wl,-rpath,$(SYCL_SDK_DIR)/lib
|
||||||
|
SYCL_HIPSYCL_INCLUDE =
|
||||||
|
SYCL_HIPSYCL_CXX = $(SYCL_HIPSYCL_SYCLCXX)
|
||||||
|
SYCL_HIPSYCL_DEPS =
|
||||||
|
|
||||||
|
SYCL_DPCPP_SYCLFLAGS_CPU = -O3 --std=c++17
|
||||||
|
SYCL_DPCPP_SYCLFLAGS_NVIDIA = -O3 --std=c++17 -fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice -fsycl-unnamed-lambda
|
||||||
|
SYCL_DPCPP_SYCLCXX = dpcpp
|
||||||
|
SYCL_DPCPP_FLAGS = $(SYCL_DPCPP_SYCLFLAGS_CPU)
|
||||||
|
SYCL_DPCPP_LINK_FLAGS =
|
||||||
|
SYCL_DPCPP_INCLUDE =
|
||||||
|
SYCL_DPCPP_CXX = dpcpp
|
||||||
|
SYCL_DPCPP_DEPS =
|
||||||
|
|
||||||
|
|
||||||
|
SYCL_SYCLFLAGS = $(SYCL_$(COMPILER)_SYCLFLAGS_$(TARGET))
|
||||||
|
SYCL_SYCLCXX = $(SYCL_$(COMPILER)_SYCLCXX)
|
||||||
|
|
||||||
|
SYCL_FLAGS = $(SYCL_$(COMPILER)_FLAGS)
|
||||||
|
SYCL_LINK_FLAGS = $(SYCL_$(COMPILER)_LINK_FLAGS)
|
||||||
|
SYCL_INCLUDE = $(SYCL_$(COMPILER)_INCLUDE)
|
||||||
|
SYCL_CXX = $(SYCL_$(COMPILER)_CXX)
|
||||||
|
SYCL_DEPS = $(SYCL_$(COMPILER)_DEPS)
|
||||||
|
|
||||||
|
sycl-stream: main.o SYCLStream.o $(SYCL_DEPS)
|
||||||
|
$(SYCL_CXX) $(SYCL_FLAGS) -DSYCL main.o SYCLStream.o $(EXTRA_FLAGS) $(SYCL_LINK_FLAGS) -o $@
|
||||||
|
|
||||||
main.o: main.cpp
|
main.o: main.cpp
|
||||||
$(CXX) -O3 -std=c++11 -DSYCL main.cpp -c -I$(COMPUTECPP_PACKAGE_ROOT_DIR)/include $(EXTRA_FLAGS) -o $@
|
$(SYCL_CXX) $(SYCL_FLAGS) -DSYCL main.cpp -c $(SYCL_INCLUDE) $(EXTRA_FLAGS) -o $@
|
||||||
|
|
||||||
SYCLStream.o: SYCLStream.cpp SYCLStream.sycl
|
SYCLStream.o: SYCLStream.cpp $(SYCL_DEPS)
|
||||||
$(CXX) -O3 -std=c++11 -DSYCL SYCLStream.cpp -c -I$(COMPUTECPP_PACKAGE_ROOT_DIR)/include -include SYCLStream.sycl $(EXTRA_FLAGS) -o $@
|
$(SYCL_CXX) $(SYCL_FLAGS) -DSYCL SYCLStream.cpp -c $(SYCL_INCLUDE) $(EXTRA_FLAGS) -o $@
|
||||||
|
|
||||||
SYCLStream.sycl: SYCLStream.cpp
|
SYCLStream.sycl: SYCLStream.cpp
|
||||||
$(COMPUTECPP_PACKAGE_ROOT_DIR)/bin/compute++ -DSYCL SYCLStream.cpp $(COMPUTECPP_FLAGS) -c -I$(COMPUTECPP_PACKAGE_ROOT_DIR)/include -o $@
|
$(SYCL_SYCLCXX) -DSYCL SYCLStream.cpp $(SYCL_SYCLFLAGS) -c $(SYCL_INCLUDE) -o $@
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user