- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have this very simple example:
#include <stdio.h>
int main() {
double *ptr = reinterpret_cast<double*>(0xdeadbeef);
printf("ptr=%p\n", ptr);
#pragma omp target parallel for simd is_device_ptr(ptr) if(true)
for(int i = 0; i < 1; ++i) {
printf("ptr=%p\n", ptr);
}
#pragma omp target parallel for simd if(true) is_device_ptr(ptr)
for(int i = 0; i < 1; ++i) {
printf("ptr=%p\n", ptr);
}
return 100;
}
For which I follow these steps in Intel DevCloud:
- qsub -I -l nodes=1:gpu:ppn=2 -d .
- icpx -qopenmp -fopenmp-targets=spir64 openmp_target_offload_clause_ordering.cpp
- export OMP_TARGET_OFFLOAD=MANDATORY
- ./a.out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
From the code snippet you have shared with us we have observed that the pointer you are passing is not a valid device pointer.
Could you please try with the below-changed code snippet and let us know if you further face any issues?
#include <stdio.h>
#include <omp.h>
int main() {
double *ptr = reinterpret_cast<double*>(omp_target_alloc(size, 0));
printf("ptr=%p\n", ptr);
#pragma omp target parallel for simd is_device_ptr(ptr) if(true)
for(int i = 0; i < 1; ++i) {
printf("ptr=%p\n", ptr);
}
#pragma omp target parallel for simd if(true) is_device_ptr(ptr)
for(int i = 0; i < 1; ++i) {
printf("ptr=%p\n", ptr);
}
return 100;
}
Replace:
double *ptr = reinterpret_cast<double*>(omp_target_alloc(size, 0));
instead of:
double *ptr = reinterpret_cast<double*>(0xdeadbeef);
Thanks & Regards
Shivani
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for posting in the Intel forums
We are able to reproduce the issue at our end by following the steps you have provided. We are working on it and will get back to you.
Thanks & Regards
Shivani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shivani,
Thank you very much for your quick response.
I am looking forward to hearing from you regarding this compiler issue.
Best,
Christos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
From the code snippet you have shared with us we have observed that the pointer you are passing is not a valid device pointer.
Could you please try with the below-changed code snippet and let us know if you further face any issues?
#include <stdio.h>
#include <omp.h>
int main() {
double *ptr = reinterpret_cast<double*>(omp_target_alloc(size, 0));
printf("ptr=%p\n", ptr);
#pragma omp target parallel for simd is_device_ptr(ptr) if(true)
for(int i = 0; i < 1; ++i) {
printf("ptr=%p\n", ptr);
}
#pragma omp target parallel for simd if(true) is_device_ptr(ptr)
for(int i = 0; i < 1; ++i) {
printf("ptr=%p\n", ptr);
}
return 100;
}
Replace:
double *ptr = reinterpret_cast<double*>(omp_target_alloc(size, 0));
instead of:
double *ptr = reinterpret_cast<double*>(0xdeadbeef);
Thanks & Regards
Shivani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shivani,
Thank you very much for your prompt response.
Indeed, after your suggestion the code works without any issue.
Thanks for resolving it!
Best,
Christos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Thanks & Regards
Shivani
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page