-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from yasahi-hpc/hotfix-thrust-version
Hotfix thrust version
- Loading branch information
Showing
28 changed files
with
204 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef __DEVICE_UTILS_HPP__ | ||
#define __DEVICE_UTILS_HPP__ | ||
|
||
#include <cstdio> | ||
|
||
namespace Impl { | ||
#if defined(_NVHPC_CUDA) || defined(__CUDACC__) | ||
inline void synchronize() { | ||
cudaDeviceSynchronize(); | ||
} | ||
|
||
inline void setDevice(int rank) { | ||
int count; | ||
int id; | ||
|
||
cudaGetDeviceCount(&count); | ||
cudaSetDevice(rank % count); | ||
cudaGetDevice(&id); | ||
printf("Process%d running on GPU%d\n", rank, id); | ||
} | ||
#elif defined(__HIPCC__) | ||
#include <hip/hip_runtime.h> | ||
inline void synchronize() { | ||
[[maybe_unused]] hipError_t err = hipDeviceSynchronize(); | ||
} | ||
|
||
inline void setDevice(int rank) { | ||
int count; | ||
int id; | ||
hipError_t err; | ||
|
||
err = hipGetDeviceCount(&count); | ||
err = hipSetDevice(rank % count); | ||
err = hipGetDevice(&id); | ||
printf("Process%d running on GPU%d\n", rank, id); | ||
} | ||
|
||
#else | ||
inline void synchronize() {} | ||
inline void setDevice(int rank) {} | ||
#endif | ||
}; | ||
|
||
#endif |
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
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
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
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
Oops, something went wrong.