8000 [SYClomatic] Fix features/libcu_atomic missing kernel config (#119) · oneapi-src/SYCLomatic-test@9bd2b49 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9bd2b49

Browse files
authored
[SYClomatic] Fix features/libcu_atomic missing kernel config (#119)
Signed-off-by: Ni, Wenhui <wenhui.ni@intel.com>
1 parent 284cb26 commit 9bd2b49

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

features/feature_case/libcu/libcu_atomic.cu

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ int main(){
2929

3030
ans = a.fetch_add(1);
3131
ans = a.fetch_sub(-1);
32-
33-
int * data = new int(0);
34-
example_kernel(data) ;
35-
return 0;
32+
int data_host = 0;
33+
int * data_ptr_device;
34+
cudaMalloc(&data_ptr_device, sizeof(unsigned int));
35+
cudaMemcpy(data_ptr_device, &data_host, sizeof(unsigned int) , cudaMemcpyHostToDevice);
36+
example_kernel<<<1,1>>>(data_ptr_device) ;
37+
cudaMemcpy(&data_host, data_ptr_device, sizeof(unsigned int) , cudaMemcpyDeviceToHost);
38+
cudaFree(data_ptr_device);
39+
if(data_host==42)
40+
return 0;
41+
return 1;
3642
}

0 commit comments

Comments
 (0)
0