CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
61 lines
1.4 KiB
C
61 lines
1.4 KiB
C
// RUN: %libomptarget-compile-run-and-check-generic
|
|
|
|
// REQUIRES: unified_shared_memory
|
|
// UNSUPPORTED: amdgcn-amd-amdhsa
|
|
//
|
|
// XFAIL: intelgpu
|
|
|
|
#pragma omp declare target
|
|
int *ptr1;
|
|
#pragma omp end declare target
|
|
int a[10];
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
int main() {
|
|
ptr1 = (int *)malloc(sizeof(int) * 100);
|
|
int *ptr2;
|
|
ptr2 = (int *)malloc(sizeof(int) * 100);
|
|
#pragma omp target map(ptr1, ptr1[ : 100])
|
|
{ ptr1[1] = 6; }
|
|
// CHECK: 6
|
|
printf(" %d \n", ptr1[1]);
|
|
#pragma omp target data map(ptr1[ : 5])
|
|
{
|
|
#pragma omp target map(ptr1[2], ptr1, ptr1[3]) map(ptr2, ptr2[2])
|
|
{
|
|
ptr1[2] = 7;
|
|
ptr1[3] = 9;
|
|
ptr2[2] = 7;
|
|
}
|
|
}
|
|
// CHECK: 7 7 9
|
|
printf(" %d %d %d \n", ptr2[2], ptr1[2], ptr1[3]);
|
|
free(ptr1);
|
|
#pragma omp target map(ptr2, ptr2[ : 100])
|
|
{ ptr2[1] = 6; }
|
|
// CHECK: 6
|
|
printf(" %d \n", ptr2[1]);
|
|
free(ptr2);
|
|
|
|
a[1] = 111;
|
|
int *p = &a[0];
|
|
// CHECK: 111
|
|
printf("%d %p %p\n", p[1], p, &p); // 111 hst_p1 hst_p2
|
|
#pragma omp target data map(to : p[1 : 3]) map(p)
|
|
#pragma omp target data use_device_addr(p)
|
|
{
|
|
#pragma omp target has_device_addr(p)
|
|
{
|
|
// CHECK: 111
|
|
printf("%d %p %p\n", p[1], p, &p); // 111 dev_p1 dev_p2
|
|
p[1] = 222;
|
|
// CHECK: 222
|
|
printf("%d %p %p\n", p[1], p, &p); // 222 dev_p1 dev_p2
|
|
}
|
|
}
|
|
// CHECK: 111
|
|
printf("%d %p %p\n", p[1], p, &p); // 111 hst_p1 hst_p2
|
|
return 0;
|
|
}
|