-
Notifications
You must be signed in to change notification settings - Fork 483
GPU: Provide general GPUChkErr functionality also externally and several unrelated changes #14062
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
7 commits
Select commit
Hold shift + click to select a range
8e8965d
GPU: Provide general GPUFailedMsg functionality also externally
davidrohr e5e4e1c
GPU: Rename GPUFailedMsg to GPUChkErr
davidrohr d7d0ee9
Fix compiler warning
davidrohr 36d0ea0
GPU: Clean up more of C++ < 11 compatibility code
davidrohr cb499fb
GPU: Provide static versions of GPUChkErr() macros
davidrohr 0a56fcd
GPU: Automatically derive GPUReconstruction backend class from prepro…
davidrohr 1a4806d
GPU: Plenty of clang-format fixes
davidrohr 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
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,62 @@ | ||
| // Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| // All rights not expressly granted are reserved. | ||
| // | ||
| // This software is distributed under the terms of the GNU General Public | ||
| // License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
| /// \file GPUCommonHelpers.h | ||
| /// \author David Rohr | ||
|
|
||
| // GPUChkErr and GPUChkErrI will both check x for an error, using the loaded backend of GPUReconstruction (requiring GPUReconstruction.h to be included by the user). | ||
| // In case of an error, it will print out the corresponding CUDA / HIP / OpenCL error code | ||
| // GPUChkErr will download GPUReconstruction error values from GPU, print them, and terminate the application with an exception if an error occured. | ||
| // GPUChkErrI will return 0 or 1, depending on whether an error has occurred. | ||
| // These Macros must be called ona GPUReconstruction instance. | ||
| // The GPUChkErrS and GPUChkErrSI are similar but static, without required GPUReconstruction instance. | ||
| // Examples: | ||
| // if (mRec->GPUChkErrI(cudaMalloc(...))) { exit(1); } | ||
| // gpuRecObj.GPUChkErr(cudaMalloc(...)); | ||
| // if (GPUChkErrSI(cudaMalloc(..))) { exit(1); } | ||
|
|
||
| #ifndef GPUCOMMONHELPERS_H | ||
| #define GPUCOMMONHELPERS_H | ||
|
|
||
| // Please #include "GPUReconstruction.h" in your code, if you use these 2! | ||
| #define GPUChkErr(x) GPUChkErrA(x, __FILE__, __LINE__, true) | ||
| #define GPUChkErrI(x) GPUChkErrA(x, __FILE__, __LINE__, false) | ||
| #define GPUChkErrS(x) o2::gpu::internal::GPUReconstructionChkErr(x, __FILE__, __LINE__, true) | ||
| #define GPUChkErrSI(x) o2::gpu::internal::GPUReconstructionChkErr(x, __FILE__, __LINE__, false) | ||
|
|
||
| #include "GPUCommonDef.h" | ||
| #include <cstdint> | ||
|
|
||
| namespace o2::gpu::internal | ||
| { | ||
| #define GPUCOMMON_INTERNAL_CAT_A(a, b, c) a##b##c | ||
| #define GPUCOMMON_INTERNAL_CAT(...) GPUCOMMON_INTERNAL_CAT_A(__VA_ARGS__) | ||
| extern int32_t GPUCOMMON_INTERNAL_CAT(GPUReconstruction, GPUCA_GPUTYPE, ChkErr)(const int64_t error, const char* file, int32_t line); | ||
| inline int32_t GPUReconstructionCPUChkErr(const int64_t error, const char* file, int32_t line) | ||
| { | ||
| if (error) { | ||
| GPUError("GPUCommon Error Code %d (%s:%d)", error, file, line); | ||
| } | ||
| return error != 0; | ||
| } | ||
| static inline int32_t GPUReconstructionChkErr(const int64_t error, const char* file, int32_t line, bool failOnError) | ||
| { | ||
| int32_t retVal = error && GPUCOMMON_INTERNAL_CAT(GPUReconstruction, GPUCA_GPUTYPE, ChkErr)(error, file, line); | ||
| if (retVal && failOnError) { | ||
| throw std::runtime_error("GPU API Call Failure"); | ||
| } | ||
| return error; | ||
| } | ||
| #undef GPUCOMMON_INTERNAL_CAT_A | ||
| #undef GPUCOMMON_INTERNAL_CAT | ||
| } // namespace o2::gpu::internal | ||
|
|
||
| #endif | ||
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mconcas : You should be able to use GPUChkErrS and GPUChkErrSI statically, if you link against the external provider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx, I'll try it!