Skip to content

Commit

Permalink
Use cuda/12.0 and fix cuda/hip compile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ZamanLantra committed Sep 20, 2024
1 parent 368eba0 commit 85c0228
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
6 changes: 4 additions & 2 deletions opp_lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ HIPCC = $(HIP_COMPILER)
SYCLCC = icpx

CPPFLAGS = -std=c++17 -Wall -fPIC -march=native $(CPPFLAGS_ADD)
NVCCFLAGS = -std=c++17 --extended-lambda -m64 -Xptxas -dlcm=ca -Xptxas=-v $(NVCCFLAGS_ADD)
NVCCFLAGS = -std=c++17 --extended-lambda -m64 -Xptxas -dlcm=ca $(NVCCFLAGS_ADD)
HIPCCFLAGS = $(HIPCCFLAGS_ADD) -std=c++17 -isystem -D__HIP_PLATFORM_AMD__ -munsafe-fp-atomics -march=native
SYCLFLAGS = -w -fsycl -std=c++17 $(SYCLFLAGS_ADD) -DUSE_SYCL

Expand Down Expand Up @@ -64,6 +64,7 @@ ifeq ($(EXT_HALOS), 0)
CPPFLAGS += -DNO_EXTENDED_HALOS
NVCCFLAGS += -DNO_EXTENDED_HALOS
HIPCCFLAGS += -DNO_EXTENDED_HALOS
SYCLFLAGS += -DNO_EXTENDED_HALOS
endif

PETSC ?= 0
Expand Down Expand Up @@ -318,6 +319,7 @@ omp_mpi: clean mklib
clean:
rm -rf *.o *.d *.a
rm -rf $(OBJ)/*
rm -rf $(LIB)/*

# rm -rf $(LIB)/*

# ------------------------------------------------------------------------------------------
1 change: 1 addition & 0 deletions opp_lib/include/opp_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define cutilCheckMsg(msg) __cutilCheckMsg(msg, __FILE__, __LINE__)

#define OPP_GPU_THREADS_PER_BLOCK 32
constexpr bool debugger = false;

#define OPP_PARTICLE_MOVE_DONE { m.move_status = OPP_MOVE_DONE; }
#define OPP_PARTICLE_NEED_MOVE { m.move_status = OPP_NEED_MOVE; }
Expand Down
3 changes: 2 additions & 1 deletion opp_lib/include/opp_hip.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define cutilCheckMsg(msg) __cutilCheckMsg(msg, __FILE__, __LINE__)

#define OPP_GPU_THREADS_PER_BLOCK 32
constexpr bool debugger = false;

#define OPP_PARTICLE_MOVE_DONE { m.move_status = OPP_MOVE_DONE; }
#define OPP_PARTICLE_NEED_MOVE { m.move_status = OPP_NEED_MOVE; }
Expand Down Expand Up @@ -490,7 +491,7 @@ class opp_mem {
// Copy data from host to device, create new device arrays if requested
template <typename T>
inline static void copy_host_to_dev(T*& data_d, const T *data_h, size_t copy_count,
bool create_new = false, size_t alloc_count = 0) {
bool no_wait = false, bool create_new = false, size_t alloc_count = 0) {
if (create_new) {
if (data_d != nullptr)
opp_mem::dev_free<T>(data_d);
Expand Down
14 changes: 12 additions & 2 deletions scripts/source/demos_sycl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ export SYCLFLAGS_ADD="-fp-model precise -fsycl-targets=nvptx64-nvidia-cuda -Xsyc
# export SYCLFLAGS_ADD=" -fsycl-targets=spir64_x86_64 "
# export SYCLFLAGS_ADD="-fp-model precise -fsycl-targets=nvptx64-nvidia-cuda -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_90 -Xcuda-ptxas --maxrregcount=128"

module load cuda/12.5
# module load cuda/12.5
# export CUDA_INSTALL_PATH="/opt/cuda/12.5"
module load cuda/12.0
export CUDA_INSTALL_PATH="/opt/nvidia/hpc_sdk/Linux_x86_64/23.1/cuda/12.0"

export NVCCFLAGS_ADD='-gencode arch=compute_90,code=sm_90'
export CUDA_INSTALL_PATH="/opt/cuda/12.5"
export CUDA_ARCH=90

. /home/zl/spack_install/spack_demos/opt/spack/linux-debian12-zen3/gcc-12.2.0/intel-oneapi-compilers-2024.2.1-jpypt464ei5wbrl2bly2y3hbngnhp3j4/setvars.sh --include-intel-llvm
Expand All @@ -31,6 +34,13 @@ export PETSC_INSTALL_PATH=/home/zl/lib_install/petsc-3.20.5-oneapi-2024.2.1_demo
export HDF5_INSTALL_PATH=$(spack location -i hdf5@1.14.3)
export LD_LIBRARY_PATH=$HDF5_INSTALL_PATH/lib:$LD_LIBRARY_PATH

# install cuda plugin!
# sh oneapi-for-nvidia-gpus-2024.2.1-cuda-12.0-linux.sh --install-dir /home/zl/spack_install/spack_demos/opt/spack/linux-debian12-zen3/gcc-12.2.0/intel-oneapi-compilers-2024.2.1-jpypt464ei5wbrl2bly2y3hbngnhp3j4

# dpct conversions
# dpct --cuda-include-path=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/cuda/include --process-all --in-root=. --out-root=/home/zl/phd/test/OP-PIC/dpct_lib
# dpct --extra-arg="-DUSE_THRUST" --extra-arg="-DUSE_MPI" --extra-arg="-I/home/zl/phd/test/OP-PIC/opp_lib/include" --cuda-include-path=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/cuda/include --process-all --in-root=. --out-root=/home/zl/phd/test/OP-PIC/dpct_lib
# dpct --extra-arg="-DUSE_THRUST" --extra-arg="-DUSE_MPI" --extra-arg="-I/home/zl/phd/test/OP-PIC/opp_lib/include" --cuda-include-path=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/cuda/include --process-all --in-root=. --out-root=/home/zl/phd/test/OP-PIC/dpct_cabanapic_cg


# module load compiler-rt/latest
Expand Down

0 comments on commit 85c0228

Please sign in to comment.