<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Siegmar,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The problem was related to parallel reduction. Jonas Hahnfeld submitted a patch (thanks Jonas). Your code must now work. Please update your copy of libomptarget and recompile it. Let us know if there are any further issues.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
George</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Siegmar Gross <siegmar.gross@informatik.hs-fulda.de><br>
<b>Sent:</b> 01 October 2018 15:59<br>
<b>To:</b> George Rokos; llvm-openmp-dev<br>
<b>Subject:</b> Re: [Openmp-dev] Libomptarget fatal error 1: failure of target construct while offloading is mandatory</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi George,<br>
<br>
thank you very much for your suggestions.<br>
<br>
> Apparently your application fails to offload to the GPU. And because offloading
<br>
> is mandatory (that's the default behavior) the library terminates the application.<br>
> <br>
> Can you compile libomptarget in debug mode and run the app with <br>
> LIBOMPTARGET_DEBUG=1 to see the debug output? That will help us identify the <br>
> problem.<br>
<br>
<br>
<br>
loki introduction 115 clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda <br>
dot_prod_accelerator_OpenMP.c<br>
loki introduction 116 a.out<br>
Number of processors:     24<br>
Number of devices:        1<br>
Default device:           0<br>
Is initial device:        1<br>
Libomptarget fatal error 1: failure of target construct while offloading is <br>
mandatory<br>
<br>
<br>
loki introduction 117 setenv LIBOMPTARGET_DEBUG 1<br>
loki introduction 118 a.out<br>
Libomptarget --> Loading RTLs...<br>
Libomptarget --> Loading library 'libomptarget.rtl.ppc64.so'...<br>
Libomptarget --> Unable to load library 'libomptarget.rtl.ppc64.so': <br>
libomptarget.rtl.ppc64.so: cannot open shared object file: No such file or <br>
directory!<br>
Libomptarget --> Loading library 'libomptarget.rtl.x86_64.so'...<br>
Libomptarget --> Successfully loaded library 'libomptarget.rtl.x86_64.so'!<br>
Libomptarget --> Registering RTL libomptarget.rtl.x86_64.so supporting 4 devices!<br>
Libomptarget --> Loading library 'libomptarget.rtl.cuda.so'...<br>
Target CUDA RTL --> Start initializing CUDA<br>
Libomptarget --> Successfully loaded library 'libomptarget.rtl.cuda.so'!<br>
Libomptarget --> Registering RTL libomptarget.rtl.cuda.so supporting 1 devices!<br>
Libomptarget --> Loading library 'libomptarget.rtl.aarch64.so'...<br>
Libomptarget --> Unable to load library 'libomptarget.rtl.aarch64.so': <br>
libomptarget.rtl.aarch64.so: cannot open shared object file: No such file or <br>
directory!<br>
Libomptarget --> RTLs loaded!<br>
Libomptarget --> Image 0x0000000000602090 is NOT compatible with RTL <br>
libomptarget.rtl.x86_64.so!<br>
Libomptarget --> Image 0x0000000000602090 is compatible with RTL <br>
libomptarget.rtl.cuda.so!<br>
Libomptarget --> RTL 0x00000000609f95d0 has index 0!<br>
Libomptarget --> Registering image 0x0000000000602090 with RTL <br>
libomptarget.rtl.cuda.so!<br>
Libomptarget --> Done registering entries!<br>
Libomptarget --> Call to omp_get_num_devices returning 1<br>
Libomptarget --> Default TARGET OFFLOAD policy is now mandatory (devicew were found)<br>
Libomptarget --> Entering target region with entry point 0x00000000004012d0 and <br>
device Id -1<br>
Libomptarget --> Checking whether device 0 is ready.<br>
Libomptarget --> Is the device 0 (local ID 0) initialized? 0<br>
Target CUDA RTL --> Getting device 0<br>
Target CUDA RTL --> Max CUDA blocks per grid 2147483647 exceeds the hard team <br>
limit 65536, capping at the hard limit<br>
Target CUDA RTL --> Using 1024 CUDA threads per block<br>
Target CUDA RTL --> Max number of CUDA blocks 65536, threads 1024 & warp size 32<br>
Target CUDA RTL --> Default number of teams set according to library's default 128<br>
Target CUDA RTL --> Default number of threads set according to library's default 128<br>
Libomptarget --> Device 0 is ready to use.<br>
Target CUDA RTL --> Load data from image 0x0000000000602090<br>
Target CUDA RTL --> CUDA module successfully loaded!<br>
Target CUDA RTL --> Entry point 0x0000000000000000 maps to <br>
__omp_offloading_2b_1890d30_main_l48 (0x0000000060f23320)<br>
Target CUDA RTL --> Entry point 0x0000000000000001 maps to <br>
__omp_offloading_2b_1890d30_main_l67 (0x0000000060f27c70)<br>
Target CUDA RTL --> Sending global device environment data 4 bytes<br>
Libomptarget --> Entry  0: Base=0x0000000000613bf0, Begin=0x0000000000613bf0, <br>
Size=800000000, Type=0x22<br>
Libomptarget --> Entry  1: Base=0x00000000301043f0, Begin=0x00000000301043f0, <br>
Size=800000000, Type=0x22<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x0000000000613bf0, <br>
Size=800000000)...<br>
Libomptarget --> Creating new map entry: HstBase=0x0000000000613bf0, <br>
HstBegin=0x0000000000613bf0, HstEnd=0x00000000301043f0, TgtBegin=0x0000000b08c20000<br>
Libomptarget --> There are 800000000 bytes allocated at target address <br>
0x0000000b08c20000 - is new<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x00000000301043f0, <br>
Size=800000000)...<br>
Libomptarget --> Creating new map entry: HstBase=0x00000000301043f0, <br>
HstBegin=0x00000000301043f0, HstEnd=0x000000005fbf4bf0, TgtBegin=0x0000000b38720000<br>
Libomptarget --> There are 800000000 bytes allocated at target address <br>
0x0000000b38720000 - is new<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x0000000000613bf0, <br>
Size=800000000)...<br>
Libomptarget --> Mapping exists with HstPtrBegin=0x0000000000613bf0, <br>
TgtPtrBegin=0x0000000b08c20000, Size=800000000, RefCount=1<br>
Libomptarget --> Obtained target argument 0x0000000b08c20000 from host pointer <br>
0x0000000000613bf0<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x00000000301043f0, <br>
Size=800000000)...<br>
Libomptarget --> Mapping exists with HstPtrBegin=0x00000000301043f0, <br>
TgtPtrBegin=0x0000000b38720000, Size=800000000, RefCount=1<br>
Libomptarget --> Obtained target argument 0x0000000b38720000 from host pointer <br>
0x00000000301043f0<br>
Libomptarget --> Launching target execution __omp_offloading_2b_1890d30_main_l48 <br>
with pointer 0x0000000060ee2ee0 (index=0).<br>
Target CUDA RTL --> Setting CUDA threads per block to default 128<br>
Target CUDA RTL --> Using requested number of teams 1<br>
Target CUDA RTL --> Launch kernel with 1 blocks and 128 threads<br>
Target CUDA RTL --> Launch of entry point at 0x0000000060ee2ee0 successful!<br>
Target CUDA RTL --> Kernel execution at 0x0000000060ee2ee0 successful!<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x00000000301043f0, <br>
Size=800000000)...<br>
Libomptarget --> Mapping exists with HstPtrBegin=0x00000000301043f0, <br>
TgtPtrBegin=0x0000000b38720000, Size=800000000, updated RefCount=1<br>
Libomptarget --> There are 800000000 bytes allocated at target address <br>
0x0000000b38720000 - is last<br>
Libomptarget --> Moving 800000000 bytes (tgt:0x0000000b38720000) -> <br>
(hst:0x00000000301043f0)<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x00000000301043f0, <br>
Size=800000000)...<br>
Libomptarget --> Deleting tgt data 0x0000000b38720000 of size 800000000<br>
Libomptarget --> Removing mapping with HstPtrBegin=0x00000000301043f0, <br>
TgtPtrBegin=0x0000000b38720000, Size=800000000<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x0000000000613bf0, <br>
Size=800000000)...<br>
Libomptarget --> Mapping exists with HstPtrBegin=0x0000000000613bf0, <br>
TgtPtrBegin=0x0000000b08c20000, Size=800000000, updated RefCount=1<br>
Libomptarget --> There are 800000000 bytes allocated at target address <br>
0x0000000b08c20000 - is last<br>
Libomptarget --> Moving 800000000 bytes (tgt:0x0000000b08c20000) -> <br>
(hst:0x0000000000613bf0)<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x0000000000613bf0, <br>
Size=800000000)...<br>
Libomptarget --> Deleting tgt data 0x0000000b08c20000 of size 800000000<br>
Libomptarget --> Removing mapping with HstPtrBegin=0x0000000000613bf0, <br>
TgtPtrBegin=0x0000000b08c20000, Size=800000000<br>
Libomptarget --> Call to omp_get_num_devices returning 1<br>
Number of processors:     24<br>
Number of devices:        1<br>
Default device:           0<br>
Is initial device:        1<br>
Libomptarget --> Entering target region with entry point 0x00000000004012d1 and <br>
device Id -1<br>
Libomptarget --> Checking whether device 0 is ready.<br>
Libomptarget --> Is the device 0 (local ID 0) initialized? 1<br>
Libomptarget --> Device 0 is ready to use.<br>
Libomptarget --> Entry  0: Base=0x0000000000613bf0, Begin=0x0000000000613bf0, <br>
Size=800000000, Type=0x21<br>
Libomptarget --> Entry  1: Base=0x00000000301043f0, Begin=0x00000000301043f0, <br>
Size=800000000, Type=0x21<br>
Libomptarget --> Entry  2: Base=0x00007fff707a86e8, Begin=0x00007fff707a86e8, <br>
Size=8, Type=0x23<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x0000000000613bf0, <br>
Size=800000000)...<br>
Libomptarget --> Creating new map entry: HstBase=0x0000000000613bf0, <br>
HstBegin=0x0000000000613bf0, HstEnd=0x00000000301043f0, TgtBegin=0x0000000b08c20000<br>
Libomptarget --> There are 800000000 bytes allocated at target address <br>
0x0000000b08c20000 - is new<br>
Libomptarget --> Moving 800000000 bytes (hst:0x0000000000613bf0) -> <br>
(tgt:0x0000000b08c20000)<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x00000000301043f0, <br>
Size=800000000)...<br>
Libomptarget --> Creating new map entry: HstBase=0x00000000301043f0, <br>
HstBegin=0x00000000301043f0, HstEnd=0x000000005fbf4bf0, TgtBegin=0x0000000b38720000<br>
Libomptarget --> There are 800000000 bytes allocated at target address <br>
0x0000000b38720000 - is new<br>
Libomptarget --> Moving 800000000 bytes (hst:0x00000000301043f0) -> <br>
(tgt:0x0000000b38720000)<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x00007fff707a86e8, Size=8)...<br>
Libomptarget --> Creating new map entry: HstBase=0x00007fff707a86e8, <br>
HstBegin=0x00007fff707a86e8, HstEnd=0x00007fff707a86f0, TgtBegin=0x0000000b68220000<br>
Libomptarget --> There are 8 bytes allocated at target address <br>
0x0000000b68220000 - is new<br>
Libomptarget --> Moving 8 bytes (hst:0x00007fff707a86e8) -> (tgt:0x0000000b68220000)<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x0000000000613bf0, <br>
Size=800000000)...<br>
Libomptarget --> Mapping exists with HstPtrBegin=0x0000000000613bf0, <br>
TgtPtrBegin=0x0000000b08c20000, Size=800000000, RefCount=1<br>
Libomptarget --> Obtained target argument 0x0000000b08c20000 from host pointer <br>
0x0000000000613bf0<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x00000000301043f0, <br>
Size=800000000)...<br>
Libomptarget --> Mapping exists with HstPtrBegin=0x00000000301043f0, <br>
TgtPtrBegin=0x0000000b38720000, Size=800000000, RefCount=1<br>
Libomptarget --> Obtained target argument 0x0000000b38720000 from host pointer <br>
0x00000000301043f0<br>
Libomptarget --> Looking up mapping(HstPtrBegin=0x00007fff707a86e8, Size=8)...<br>
Libomptarget --> Mapping exists with HstPtrBegin=0x00007fff707a86e8, <br>
TgtPtrBegin=0x0000000b68220000, Size=8, RefCount=1<br>
Libomptarget --> Obtained target argument 0x0000000b68220000 from host pointer <br>
0x00007fff707a86e8<br>
Libomptarget --> Launching target execution __omp_offloading_2b_1890d30_main_l67 <br>
with pointer 0x0000000060ee2e70 (index=1).<br>
Target CUDA RTL --> Setting CUDA threads per block to default 128<br>
Target CUDA RTL --> Using requested number of teams 1<br>
Target CUDA RTL --> Launch kernel with 1 blocks and 128 threads<br>
Target CUDA RTL --> Launch of entry point at 0x0000000060ee2e70 successful!<br>
Target CUDA RTL --> Kernel execution error at 0x0000000060ee2e70!<br>
Target CUDA RTL --> CUDA error is: an illegal memory access was encountered<br>
Libomptarget --> Executing target region abort target.<br>
Libomptarget fatal error 1: failure of target construct while offloading is <br>
mandatory<br>
Libomptarget --> Unloading target library!<br>
Libomptarget --> Image 0x0000000000602090 is compatible with RTL 0x00000000609f95d0!<br>
Libomptarget --> Unregistered image 0x0000000000602090 from RTL 0x00000000609f95d0!<br>
Libomptarget --> Done unregistering images!<br>
Libomptarget --> Removing translation table for descriptor 0x0000000000613b90<br>
Libomptarget --> Done unregistering library!<br>
Target CUDA RTL --> Error when unloading CUDA module<br>
Target CUDA RTL --> CUDA error is: an illegal memory access was encountered<br>
loki introduction 119<br>
<br>
<br>
Thank you very much for your help in advance.<br>
<br>
<br>
Best regards<br>
<br>
Siegmar<br>
<br>
<br>
<br>
<br>
> <br>
> George<br>
> <br>
> --------------------------------------------------------------------------------<br>
> *From:* Openmp-dev <openmp-dev-bounces@lists.llvm.org> on behalf of Siegmar <br>
> Gross via Openmp-dev <openmp-dev@lists.llvm.org><br>
> *Sent:* 01 October 2018 13:26<br>
> *To:* llvm-openmp-dev<br>
> *Subject:* [Openmp-dev] Libomptarget fatal error 1: failure of target construct
<br>
> while offloading is mandatory<br>
> Hi,<br>
> <br>
> today I've installed llvm-trunk. Unfortunately, I get an error for one of my<br>
> programs.<br>
> <br>
> <br>
> loki introduction 110 clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda<br>
> dot_prod_accelerator_OpenMP.c<br>
> loki introduction 111 a.out<br>
> Number of processors:     24<br>
> Number of devices:        1<br>
> Default device:           0<br>
> Is initial device:        1<br>
> Libomptarget fatal error 1: failure of target construct while offloading is<br>
> mandatory<br>
> <br>
> loki introduction 112 setenv OMP_DEFAULT_DEVICE 1<br>
> loki introduction 113 a.out<br>
> Libomptarget fatal error 1: failure of target construct while offloading is<br>
> mandatory<br>
> <br>
> loki introduction 114 clang -v<br>
> clang version 8.0.0 (trunk 343447)<br>
> Target: x86_64-unknown-linux-gnu<br>
> Thread model: posix<br>
> InstalledDir: /usr/local/llvm-trunk/bin<br>
> Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/4.8<br>
> Selected GCC installation: /usr/lib64/gcc/x86_64-suse-linux/4.8<br>
> Candidate multilib: .;@m64<br>
> Candidate multilib: 32;@m32<br>
> Selected multilib: .;@m64<br>
> Found CUDA installation: /usr/local/cuda-9.0, version 9.0<br>
> loki introduction 115<br>
> <br>
> <br>
> <br>
> The program works fine with llvm-7.0.0.<br>
> <br>
> loki introduction 125 clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda<br>
> dot_prod_accelerator_OpenMP.c<br>
> loki introduction 126 a.out<br>
> Number of processors:     24<br>
> Number of devices:        1<br>
> Default device:           0<br>
> Is initial device:        1<br>
> sum = 6.000000e+08<br>
> <br>
> loki introduction 127 setenv OMP_DEFAULT_DEVICE 1<br>
> loki introduction 128 a.out<br>
> Number of processors:     24<br>
> Number of devices:        1<br>
> Default device:           1<br>
> Is initial device:        1<br>
> sum = 6.000000e+08<br>
> <br>
> loki introduction 129 clang -v<br>
> clang version 7.0.0 (tags/RELEASE_700/final)<br>
> Target: x86_64-unknown-linux-gnu<br>
> Thread model: posix<br>
> InstalledDir: /usr/local/llvm-7.0.0/bin<br>
> Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/4.8<br>
> Selected GCC installation: /usr/lib64/gcc/x86_64-suse-linux/4.8<br>
> Candidate multilib: .;@m64<br>
> Candidate multilib: 32;@m32<br>
> Selected multilib: .;@m64<br>
> Found CUDA installation: /usr/local/cuda-9.0, version 9.0<br>
> loki introduction 130<br>
> <br>
> <br>
> Hopefully somebody can fix the problem. Do you need anything else to locate the<br>
> error? Thank you very much for any help in advance.<br>
> <br>
> <br>
> Kind regards<br>
> <br>
> Siegmar<br>
</div>
</span></font></div>
</body>
</html>