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
74 lines
2.4 KiB
C
74 lines
2.4 KiB
C
// clang-format off
|
|
// RUN: %libomptarget-compile-run-and-check-generic
|
|
// REQUIRES: ompt
|
|
// REQUIRES: gpu
|
|
// clang-format on
|
|
|
|
/*
|
|
* Verify that for the target OpenMP APIs, the return address is non-null and
|
|
* distinct.
|
|
*/
|
|
|
|
#include <omp.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "callbacks.h"
|
|
#include "register_non_emi.h"
|
|
|
|
int main() {
|
|
int dev = omp_get_default_device();
|
|
int host = omp_get_initial_device();
|
|
|
|
int host_var1 = 42;
|
|
int host_var2 = 0;
|
|
void *dev_ptr = NULL;
|
|
|
|
// Allocate space on the device
|
|
dev_ptr = omp_target_alloc(sizeof(int), dev);
|
|
if (dev_ptr == NULL)
|
|
abort();
|
|
|
|
// H2D transfer
|
|
if (omp_target_memcpy(dev_ptr, &host_var1, sizeof(int), 0, 0, dev, host))
|
|
abort();
|
|
|
|
// D2D transfer
|
|
if (omp_target_memcpy(dev_ptr, dev_ptr, sizeof(int), 0, 0, dev, dev))
|
|
abort();
|
|
|
|
// D2H transfer
|
|
if (omp_target_memcpy(&host_var2, dev_ptr, sizeof(int), 0, 0, host, dev))
|
|
abort();
|
|
|
|
// Free the device location
|
|
omp_target_free(dev_ptr, dev);
|
|
|
|
// Both host variables should have the same value.
|
|
return host_var1 != host_var2;
|
|
}
|
|
|
|
// clang-format off
|
|
/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_alloc
|
|
/// CHECK-SAME: src_device_num=[[HOST:-1]]
|
|
/// CHECK-SAME: dest_device_num=[[DEVICE:[0-9]+]]
|
|
/// CHECK-NOT: code=(nil)
|
|
/// CHECK: code=[[CODE1:0x[0-f]+]]
|
|
/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_transfer_to_device
|
|
/// CHECK-SAME: src_device_num=[[HOST]] {{.+}} dest_device_num=[[DEVICE]]
|
|
/// CHECK-NOT: code=(nil)
|
|
/// CHECK-NOT: code=[[CODE1]]
|
|
/// CHECK: code=[[CODE2:0x[0-f]+]]
|
|
/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_transfer_from_device
|
|
/// CHECK-SAME: src_device_num=[[DEVICE]] {{.+}} dest_device_num=[[DEVICE]]
|
|
/// CHECK-NOT: code=(nil)
|
|
/// CHECK-NOT: code=[[CODE2]]
|
|
/// CHECK: code=[[CODE3:0x[0-f]+]]
|
|
/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_transfer_from_device
|
|
/// CHECK-SAME: src_device_num=[[DEVICE]] {{.+}} dest_device_num=[[HOST]]
|
|
/// CHECK-NOT: code=(nil)
|
|
/// CHECK-NOT: code=[[CODE3]]
|
|
/// CHECK: code=[[CODE4:0x[0-f]+]]
|
|
/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_delete
|
|
/// CHECK-NOT: code=(nil)
|
|
/// CHECK-NOT: code=[[CODE4]]
|