forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 153
[Fix]Enable abacus to be compiled with CXX 17 & CUDA 13 #6777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f1ff987
Update cuda_compat.h
ZhouXY-PKU e2e013f
Create cuda_compat.cpp
ZhouXY-PKU fff6075
Update output_device.cpp
ZhouXY-PKU 7bdaee6
Update global.h
ZhouXY-PKU 7a20401
Update helper_cuda.h
ZhouXY-PKU c899d18
Update output_device.cpp
ZhouXY-PKU 359ce3b
Update global.h
ZhouXY-PKU 67d413c
Update cuda_compat.h
ZhouXY-PKU 62efb32
Update global.h
ZhouXY-PKU f16f471
Update helper_cuda.h
ZhouXY-PKU 4caacaf
Update helper_cuda.h
ZhouXY-PKU 78ddf6b
Update CMakeLists.txt
ZhouXY-PKU 0a2fade
Update CMakeLists.txt
ZhouXY-PKU fc2fcd6
Update CMakeLists.txt
ZhouXY-PKU 3fa8260
Update CMakeLists.txt
ZhouXY-PKU 0c121c1
Update CMakeLists.txt
ZhouXY-PKU 01852cc
Update cuda_compat.cpp
ZhouXY-PKU 24a363e
Update cuda_compat.cpp
ZhouXY-PKU 154ddc2
Update CMakeLists.txt
ZhouXY-PKU fbd6141
Update CMakeLists.txt
ZhouXY-PKU File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| #include "cuda_compat.h" | ||
|
|
||
| namespace ModuleBase { | ||
| namespace cuda_compat { | ||
|
|
||
| //--------------------------------------------------------------------------- | ||
| // Implementation of printDeprecatedDeviceInfo and printComputeModeInfo | ||
| //--------------------------------------------------------------------------- | ||
| void printDeprecatedDeviceInfo(std::ostream& ofs_device, const cudaDeviceProp& deviceProp) | ||
| { | ||
| #if defined(CUDA_VERSION) && CUDA_VERSION < 13000 | ||
| char msg[1024]; | ||
| sprintf(msg, | ||
| " GPU Max Clock rate: %.0f MHz (%0.2f " | ||
| "GHz)\n", | ||
| deviceProp.clockRate * 1e-3f, deviceProp.clockRate * 1e-6f); | ||
| ofs_device << msg << std::endl; | ||
| // This is supported in CUDA 5.0 (runtime API device properties) | ||
| sprintf(msg, " Memory Clock rate: %.0f Mhz\n", | ||
| deviceProp.memoryClockRate * 1e-3f); | ||
| ofs_device << msg << std::endl; | ||
|
|
||
| sprintf(msg, " Memory Bus Width: %d-bit\n", | ||
| deviceProp.memoryBusWidth); | ||
| ofs_device << msg << std::endl; | ||
|
|
||
| sprintf(msg, | ||
| " Concurrent copy and kernel execution: %s with %d copy " | ||
| "engine(s)\n", | ||
| (deviceProp.deviceOverlap ? "Yes" : "No"), | ||
| deviceProp.asyncEngineCount); | ||
| ofs_device << msg << std::endl; | ||
| sprintf(msg, " Run time limit on kernels: %s\n", | ||
| deviceProp.kernelExecTimeoutEnabled ? "Yes" : "No"); | ||
| ofs_device << msg << std::endl; | ||
| #endif | ||
| } | ||
|
|
||
| void printComputeModeInfo(std::ostream& ofs_device, const cudaDeviceProp& deviceProp) | ||
| { | ||
| #if defined(CUDA_VERSION) && CUDA_VERSION < 13000 | ||
| char msg[1024]; | ||
| 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)", | ||
| "Exclusive (only one host thread in one process is able to use " | ||
| "::cudaSetDevice() with this device)", | ||
| "Prohibited (no host thread can use ::cudaSetDevice() with this " | ||
| "device)", | ||
| "Exclusive Process (many threads in one process is able to use " | ||
| "::cudaSetDevice() with this device)", | ||
| "Unknown", | ||
| NULL}; | ||
| sprintf(msg, " Compute Mode:\n"); | ||
| ofs_device << msg << std::endl; | ||
| ofs_device << " " << sComputeMode[deviceProp.computeMode] << std::endl | ||
| << std::endl; | ||
| #endif | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| // Implementation of cufftGetErrorStringCompat | ||
| //------------------------------------------------------------------------------------------------- | ||
| const char* cufftGetErrorStringCompat(cufftResult_t error) | ||
| { | ||
| switch (error) | ||
| { | ||
| case CUFFT_SUCCESS: | ||
| return "CUFFT_SUCCESS"; | ||
| case CUFFT_INVALID_PLAN: | ||
| return "CUFFT_INVALID_PLAN"; | ||
| case CUFFT_ALLOC_FAILED: | ||
| return "CUFFT_ALLOC_FAILED"; | ||
| case CUFFT_INVALID_TYPE: | ||
| return "CUFFT_INVALID_TYPE"; | ||
| case CUFFT_INVALID_VALUE: | ||
| return "CUFFT_INVALID_VALUE"; | ||
| case CUFFT_INTERNAL_ERROR: | ||
| return "CUFFT_INTERNAL_ERROR"; | ||
| case CUFFT_EXEC_FAILED: | ||
| return "CUFFT_EXEC_FAILED"; | ||
| case CUFFT_SETUP_FAILED: | ||
| return "CUFFT_SETUP_FAILED"; | ||
| case CUFFT_INVALID_SIZE: | ||
| return "CUFFT_INVALID_SIZE"; | ||
| case CUFFT_UNALIGNED_DATA: | ||
| return "CUFFT_UNALIGNED_DATA"; | ||
| case CUFFT_INVALID_DEVICE: | ||
| return "CUFFT_INVALID_DEVICE"; | ||
| case CUFFT_NO_WORKSPACE: | ||
| return "CUFFT_NO_WORKSPACE"; | ||
| case CUFFT_NOT_IMPLEMENTED: | ||
| return "CUFFT_NOT_IMPLEMENTED"; | ||
| 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>"; | ||
| } | ||
| } | ||
|
|
||
| } // namespace cuda_compat | ||
| } // namespace ModuleBase | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.