Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cuda.h>
- #include <stdio.h>
- #define N 10
- __global__ void kernel(int *result) { return; }
- int main() {
- int **result;
- cudaMallocManaged(&result, N * sizeof(int*));
- for(int i = 0; i < N; i++) cudaMallocManaged(&result[i], sizeof(int));
- cudaDeviceSynchronize();
- printf("okay\n");
- for(int i = 0; i < N; i++) {
- kernel<<<1, 1>>>(result[i]);
- // cudaDeviceSynchronize(); // decomment me, and evertying works
- }
- cudaDeviceSynchronize();
- printf("perfect\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement