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
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ set(ABACUS_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/${ABACUS_BIN_NAME})
include_directories(${ABACUS_SOURCE_DIR})
include_directories(${ABACUS_SOURCE_DIR}/module_base/module_container)

set(CMAKE_CXX_STANDARD 11)
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(${ABACUS_BIN_NAME} source/main.cpp)
Expand Down Expand Up @@ -294,6 +296,10 @@ endif()
if(USE_CUDA)
cmake_minimum_required(VERSION 3.18) # required by `CUDA_ARCHITECTURES` below
set_if_higher(CMAKE_CXX_STANDARD 14)
if(CUDA_VERSION VERSION_GREATER_EQUAL "13.0")
message(STATUS "CUDA ${CUDA_VERSION} detected. Setting CMAKE_CUDA_STANDARD to 17.")
set_if_higher(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
Expand Down
17 changes: 12 additions & 5 deletions source/module_base/module_device/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#if defined(__CUDA)
#include <cuda_runtime.h>
#include <cuda.h>
#endif

#if defined(__ROCM)
Expand Down Expand Up @@ -299,6 +300,7 @@ void print_device_info<base_device::DEVICE_GPU>(
sprintf(msg, " CUDA Capability Major/Minor version number: %d.%d\n",
deviceProp.major, deviceProp.minor);
ofs_device << msg << std::endl;
#if defined(CUDA_VERSION) && CUDA_VERSION < 13000
sprintf(msg,
" GPU Max Clock rate: %.0f MHz (%0.2f "
"GHz)\n",
Expand All @@ -312,6 +314,7 @@ void print_device_info<base_device::DEVICE_GPU>(
sprintf(msg, " Memory Bus Width: %d-bit\n",
deviceProp.memoryBusWidth);
ofs_device << msg << std::endl;
#endif
sprintf(msg,
" Maximum Texture Dimension Size (x,y,z) 1D=(%d), 2D=(%d, "
"%d), 3D=(%d, %d, %d)\n",
Expand Down Expand Up @@ -366,6 +369,7 @@ void print_device_info<base_device::DEVICE_GPU>(
sprintf(msg, " Texture alignment: %zu bytes\n",
deviceProp.textureAlignment);
ofs_device << msg << std::endl;
#if defined(CUDA_VERSION) && CUDA_VERSION < 13000
sprintf(msg,
" Concurrent copy and kernel execution: %s with %d copy "
"engine(s)\n",
Expand All @@ -375,6 +379,7 @@ void print_device_info<base_device::DEVICE_GPU>(
sprintf(msg, " Run time limit on kernels: %s\n",
deviceProp.kernelExecTimeoutEnabled ? "Yes" : "No");
ofs_device << msg << std::endl;
#endif
sprintf(msg, " Integrated GPU sharing Host Memory: %s\n",
deviceProp.integrated ? "Yes" : "No");
ofs_device << msg << std::endl;
Expand All @@ -399,13 +404,15 @@ void print_device_info<base_device::DEVICE_GPU>(
sprintf(msg, " Supports Cooperative Kernel Launch: %s\n",
deviceProp.cooperativeLaunch ? "Yes" : "No");
ofs_device << msg << std::endl;
sprintf(msg, " Supports MultiDevice Co-op Kernel Launch: %s\n",
deviceProp.cooperativeMultiDeviceLaunch ? "Yes" : "No");
ofs_device << msg << std::endl;
sprintf(msg,
" Device PCI Domain ID / Bus ID / location ID: %d / %d / %d\n",
deviceProp.pciDomainID, deviceProp.pciBusID, deviceProp.pciDeviceID);
ofs_device << msg << std::endl;
#if defined(CUDA_VERSION) && CUDA_VERSION < 13000
sprintf(msg, " Supports MultiDevice Co-op Kernel Launch: %s\n",
deviceProp.cooperativeMultiDeviceLaunch ? "Yes" : "No");
ofs_device << msg << std::endl;

const char *sComputeMode[] = {
"Default (multiple host threads can use ::cudaSetDevice() with device "
"simultaneously)",
Expand All @@ -421,7 +428,7 @@ void print_device_info<base_device::DEVICE_GPU>(
ofs_device << msg << std::endl;
ofs_device << " " << sComputeMode[deviceProp.computeMode] << std::endl
<< std::endl;

#endif
// If there are 2 or more GPUs, query to determine whether RDMA is supported
if (deviceCount >= 2) {
cudaDeviceProp prop[64];
Expand Down Expand Up @@ -711,4 +718,4 @@ void record_device_memory<base_device::DEVICE_GPU>(
#endif

} // end of namespace information
} // end of namespace base_device
} // end of namespace base_device
20 changes: 13 additions & 7 deletions source/module_hamilt_pw/hamilt_pwdft/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "module_hamilt_general/module_xc/xc_functional.h"
#ifdef __CUDA
#include "cublas_v2.h"
#include <cuda.h> // for CUDA_VERSION
#include "cufft.h"

static const char* _cublasGetErrorString(cublasStatus_t error)
Expand Down Expand Up @@ -65,22 +66,27 @@ static const char* _cufftGetErrorString(cufftResult_t error)
return "CUFFT_INVALID_SIZE";
case CUFFT_UNALIGNED_DATA:
return "CUFFT_UNALIGNED_DATA";
case CUFFT_INCOMPLETE_PARAMETER_LIST:
return "CUFFT_INCOMPLETE_PARAMETER_LIST";
case CUFFT_INVALID_DEVICE:
return "CUFFT_INVALID_DEVICE";
case CUFFT_PARSE_ERROR:
return "CUFFT_PARSE_ERROR";
case CUFFT_NO_WORKSPACE:
return "CUFFT_NO_WORKSPACE";
case CUFFT_NOT_IMPLEMENTED:
return "CUFFT_NOT_IMPLEMENTED";
case CUFFT_LICENSE_ERROR:
return "CUFFT_LICENSE_ERROR";
case CUFFT_NOT_SUPPORTED:
return "CUFFT_NOT_SUPPORTED";

#if defined(CUDA_VERSION) && CUDA_VERSION < 13000
case CUFFT_INCOMPLETE_PARAMETER_LIST:
return "CUFFT_INCOMPLETE_PARAMETER_LIST";
case CUFFT_PARSE_ERROR:
return "CUFFT_PARSE_ERROR";
case CUFFT_LICENSE_ERROR:
return "CUFFT_LICENSE_ERROR";
#endif

default:
return "<unknown>";
}
return "<unknown>";
}

#define CHECK_CUDA(func) \
Expand Down
23 changes: 13 additions & 10 deletions source/module_hsolver/kernels/cuda/helper_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,30 +137,33 @@ static const char *_cudaGetErrorEnum(cufftResult error) {

case CUFFT_UNALIGNED_DATA:
return "CUFFT_UNALIGNED_DATA";

case CUFFT_INCOMPLETE_PARAMETER_LIST:
return "CUFFT_INCOMPLETE_PARAMETER_LIST";


case CUFFT_INVALID_DEVICE:
return "CUFFT_INVALID_DEVICE";

case CUFFT_PARSE_ERROR:
return "CUFFT_PARSE_ERROR";

case CUFFT_NO_WORKSPACE:
return "CUFFT_NO_WORKSPACE";

case CUFFT_NOT_IMPLEMENTED:
return "CUFFT_NOT_IMPLEMENTED";

#if defined(CUDA_VERSION) && CUDA_VERSION < 13000
case CUFFT_INCOMPLETE_PARAMETER_LIST:
return "CUFFT_INCOMPLETE_PARAMETER_LIST";

case CUFFT_PARSE_ERROR:
return "CUFFT_PARSE_ERROR";

case CUFFT_LICENSE_ERROR:
return "CUFFT_LICENSE_ERROR";
#endif

case CUFFT_NOT_SUPPORTED:
return "CUFFT_NOT_SUPPORTED";

default:
return "<unknown>";
}

return "<unknown>";
}
#endif

Expand Down Expand Up @@ -965,4 +968,4 @@ inline bool checkCudaCapabilities(int major_version, int minor_version) {

// end of CUDA Helper Functions

#endif // COMMON_HELPER_CUDA_H_
#endif // COMMON_HELPER_CUDA_H_
Loading