Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions src/sedacs/gpu/nvda/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
cmake_minimum_required(VERSION 3.18)
project(nvda LANGUAGES CXX)

# ------------------------------------------------------
# Set NVIDIA compiler and flags from environment
# ------------------------------------------------------
#set(CMAKE_CXX_COMPILER $ENV{CXX})

# ------------------------------------------------------
# Configure MPI using find_package with custom path
# ------------------------------------------------------
find_package(MPI REQUIRED)

message(STATUS "MPI Include Path: ${MPI_INCLUDE_PATH}")
message(STATUS "MPI Libraries: ${MPI_CXX_LIBRARIES}")

# ------------------------------------------------------
# Include directories
# ------------------------------------------------------
include_directories(
include
${MPI_INCLUDE_PATH}
$ENV{NVHPC_ROOT}/compilers/include
$ENV{NVHPC_ROOT}/math_libs/include
$ENV{NVHPC_ROOT}/cuda/include
$ENV{LAPACK_ROOT}/include
)

# ------------------------------------------------------
# Library search paths (if needed)
# ------------------------------------------------------
link_directories(
$ENV{NVHPC_ROOT}/compilers/lib64
$ENV{NVHPC_ROOT}/math_libs/lib64
$ENV{NVHPC_ROOT}/cuda/lib64
$ENV{LAPACK_ROOT}/lib
)

# ------------------------------------------------------
# Source files (treat .cu as C++ with nvc++)
# ------------------------------------------------------
file(GLOB_RECURSE ALL_SRCS
src/diag/*.cu
src/dnnsp2/*.cu
src/dnnprt/*.cu
src/goldensp2/*.cu
src/movingmusp2/*.cu
src/fastcheby/*.cu
src/mlsp2/*.cu
src/lib/*.cu
)

# Explicitly mark .cu as C++ files
foreach(file ${ALL_SRCS})
set_source_files_properties(${file} PROPERTIES LANGUAGE CXX)
endforeach()

# ------------------------------------------------------
# Shared library target
# ------------------------------------------------------
add_library(nvda SHARED ${ALL_SRCS})
set_target_properties(nvda PROPERTIES OUTPUT_NAME "nvda")

target_link_libraries(nvda
${MPI_CXX_LIBRARIES}
cudanvhpc
cublas
cusolver
cudart
nvToolsExt
lapack
)

19 changes: 19 additions & 0 deletions src/sedacs/gpu/nvda/cmake-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# clear the build dir
rm -rf build;
mkdir build;
cd build;

cmake .. \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_CXX_COMPILER=nvc++ \
-DCMAKE_CXX_FLAGS="-O3 -cuda -gpu=cc89 -acc=gpu -Minfo=accel -fPIC \
--diag_suppress=bad_macro_redef \
--diag_suppress=cuda_compile \
--diag_suppress=declared_but_not_referenced " \
#-DNVHPC_ROOT=/opt/nvidia/hpc_sdk/Linux_x86_64/24.3 \
#-DOMPI_ROOT=/projects/shared/spack/opt/spack/linux-zen4/openmpi-5.0.7-6dehamwfocnigimmbozkxhujq4b3epqf \
#-DLAPACK_ROOT=/path/to/lapack \
#-DCMAKE_PREFIX_PATH="/projects/shared/spack/opt/spack/linux-zen4/openmpi-5.0.7-6dehamwfocnigimmbozkxhujq4b3epqf"


make -j
Loading