[ET Trac] #2844: HelloWorldCuda
Anthony Shoup
trac-noreply at einsteintoolkit.org
Thu Jan 9 10:22:30 CST 2025
#2844: HelloWorldCuda
Reporter: Anthony Shoup
Status: submitted
Milestone: ET_2024_11
Version:
Type: bug
Priority: minor
Component: EinsteinToolkit thorn
The HelloWorldCuda thorn does not seem to work in my build of the Einstein Toolkit, ET\_2024\_11 release. The routine, HelloWorldCUDA\_evol, that launches the cuda kernel uses cctk\_lsh grid size values that are very large \(x-dir > 1x10^9\), which then tries to launch too many kernels. Below is the code:
extern "C"
void HelloWorldCUDA\_evol\(CCTK\_ARGUMENTS\)
\{
DECLARE\_CCTK\_ARGUMENTS;
```
const int val1 = cctk_iteration;
const int val2 = 3;
int res = 42; // poison
const dim3 blockDim(4, 4, 4);
```
// const dim3 gridDim\(\(cctk\_lsh\[0\] \+ blockDim.x - 1\) / blockDim.x, // Commented out by ALS
// \(cctk\_lsh\[1\] \+ blockDim.y - 1\) / blockDim.y,
// \(cctk\_lsh\[2\] \+ blockDim.z - 1\) / blockDim.z\);
```
// This code does work - ALS
const dim3 gridDim((8 + blockDim.x - 1) / blockDim.x,
(8 + blockDim.y - 1) / blockDim.y,
(8 + blockDim.z - 1) / blockDim.z);
add<<<gridDim, blockDim>>>(val1, val2, &res);
cudaError_t cerr = cudaDeviceSynchronize(); // Added by ALS
check_error(cerr, "Could not do cuda device synchronize"); // Added by ALS
CCTK_VInfo(CCTK_THORNSTRING, "CUDA says(testing): %d + %d = %d", val1, val2, res);
```
\}
--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2844/helloworldcuda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.einsteintoolkit.org/pipermail/trac/attachments/20250109/3328930b/attachment.htm>
More information about the Trac
mailing list