-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix memory error in single_stage_multi_reduction_kernel (#235)
* refactor * refactor * revert * refactor: clang format * Update icicle/appUtils/msm/msm.cu
- Loading branch information
1 parent
97f0079
commit 9114ecb
Showing
3 changed files
with
59 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -224,4 +224,4 @@ int main() | |
// std::cout<<pr<<std::endl; | ||
|
||
return 0; | ||
} | ||
} |
This file contains 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,32 @@ | ||
#pragma once | ||
#include <iostream> | ||
|
||
#define CHECK_CUDA_ERROR(val) check((val), #val, __FILE__, __LINE__) | ||
template <typename T> | ||
void check(T err, const char* const func, const char* const file, const int line) | ||
{ | ||
if (err != cudaSuccess) { | ||
std::cerr << "CUDA Runtime Error at: " << file << ":" << line << std::endl; | ||
std::cerr << cudaGetErrorString(err) << " " << func << std::endl; | ||
} | ||
} | ||
|
||
#define CHECK_LAST_CUDA_ERROR() checkLast(__FILE__, __LINE__) | ||
void checkLast(const char* const file, const int line) | ||
{ | ||
cudaError_t err{cudaGetLastError()}; | ||
if (err != cudaSuccess) { | ||
std::cerr << "CUDA Runtime Error at: " << file << ":" << line << std::endl; | ||
std::cerr << cudaGetErrorString(err) << std::endl; | ||
} | ||
} | ||
|
||
#define CHECK_SYNC_DEVICE_ERROR() syncDevice(__FILE__, __LINE__) | ||
void syncDevice(const char* const file, const int line) | ||
{ | ||
cudaError_t err{cudaDeviceSynchronize()}; | ||
if (err != cudaSuccess) { | ||
std::cerr << "CUDA Runtime Error at: " << file << ":" << line << std::endl; | ||
std::cerr << cudaGetErrorString(err) << std::endl; | ||
} | ||
} |