Re: [llvm-dev] Clang driver for OpenMP target offloading

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Clang driver for OpenMP target offloading

Alex Denisov via cfe-dev
Hi Simone,

you are more likely to get answers to frontend questions asking on
cfe-dev. However, your output shows that you are using clang-ykt which
isn't supported upstream so this is not the right place for your
questions. Nevertheless, I'll answer some because the same "problem"
will arise with (upstream) trunk.

Am 2017-12-26 23:37, schrieb Simone Atzeni via llvm-dev:

> Hi,
>
> I am having some trouble to understand how the clang driver works for
> OpenMP offloading.
>
> For example, if I run the following command (with the -v flag):
>
> clang -v -g -fopenmp offloading_success.c -o offloading_success
>
> I can see the invocations that clang does and if I run those command
> one by one I can successfully compile my program.

Just to clarify: This will compile but will fallback to run on the host
because the arguments don't specify which device to compile for.

> Now, if I do the same but with the offloading option, as in the
> following command:
>
> clang -v -g -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
> offloading_success.c -o offloading_success
>
> the command works, compiles correctly, and when I run the program, it
> successfully run on the device.

(which would not be the case for upstream trunk yet...)

> However, if I show the invocations with "-v" and try to run the
> commands one by one it does not work and in particular I get an error
> with the last command which is the linking part with "ld".
> The error i get is the following:
>
> /usr/bin/ld: cannot open linker script file
> /tmp/offloading_success-2b4739.lk [1]: No such file or directory
>
> Where is this ".lk" file generated? Is there a missing commands in the
> invocations?

The linker script is generated by Clang's driver (both in clang-ykt and
trunk) and is deleted after its usage which is the default for temporary
files. If you want to inspect the intermediate files, I suggest adding
--save-temps which will dump a bunch of files to the current directory.
(AFAIK this will result in more files than generated by default so that
developers have more intermediate steps to look at.)

Cheers,
Jonas
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Clang driver for OpenMP target offloading

Alex Denisov via cfe-dev
Hi Jonas,

thanks for the answer.
For now I can use the "--save-temps" flag to keep my investigation.

Do you know what's the timeline for integrating offloading for NVidia GPUs upstream?
I remember seeing a big patch for integrating OpenMP target generation in the clang driver and I thought it was already accepted and committed, but I might be wrong.

Thanks.
Simone


On Wed, Dec 27, 2017 at 1:10 AM, Jonas Hahnfeld <[hidden email]> wrote:
Hi Simone,

you are more likely to get answers to frontend questions asking on cfe-dev. However, your output shows that you are using clang-ykt which isn't supported upstream so this is not the right place for your questions. Nevertheless, I'll answer some because the same "problem" will arise with (upstream) trunk.

Am 2017-12-26 23:37, schrieb Simone Atzeni via llvm-dev:
Hi,

I am having some trouble to understand how the clang driver works for
OpenMP offloading.

For example, if I run the following command (with the -v flag):

clang -v -g -fopenmp offloading_success.c -o offloading_success

I can see the invocations that clang does and if I run those command
one by one I can successfully compile my program.

Just to clarify: This will compile but will fallback to run on the host because the arguments don't specify which device to compile for.

Now, if I do the same but with the offloading option, as in the
following command:

clang -v -g -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
offloading_success.c -o offloading_success

the command works, compiles correctly, and when I run the program, it
successfully run on the device.

(which would not be the case for upstream trunk yet...)

However, if I show the invocations with "-v" and try to run the
commands one by one it does not work and in particular I get an error
with the last command which is the linking part with "ld".
The error i get is the following:

/usr/bin/ld: cannot open linker script file
/tmp/offloading_success-2b4739.lk [1]: No such file or directory

Where is this ".lk" file generated? Is there a missing commands in the
invocations?

The linker script is generated by Clang's driver (both in clang-ykt and trunk) and is deleted after its usage which is the default for temporary files. If you want to inspect the intermediate files, I suggest adding --save-temps which will dump a bunch of files to the current directory. (AFAIK this will result in more files than generated by default so that developers have more intermediate steps to look at.)

Cheers,
Jonas


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Clang driver for OpenMP target offloading

Alex Denisov via cfe-dev
Hi Simone,

I'm not aware of a timeline, it's ready when all necessary patches are
merged. One large missing piece is the device runtime.

Jonas

Am 2018-01-04 16:48, schrieb Simone Atzeni:

> Hi Jonas,
>
> thanks for the answer.
> For now I can use the "--save-temps" flag to keep my investigation.
>
> Do you know what's the timeline for integrating offloading for NVidia
> GPUs upstream?
> I remember seeing a big patch for integrating OpenMP target generation
> in the clang driver and I thought it was already accepted and
> committed, but I might be wrong.
>
> Thanks.
> Simone
>
> On Wed, Dec 27, 2017 at 1:10 AM, Jonas Hahnfeld <[hidden email]>
> wrote:
>
>> Hi Simone,
>>
>> you are more likely to get answers to frontend questions asking on
>> cfe-dev. However, your output shows that you are using clang-ykt
>> which isn't supported upstream so this is not the right place for
>> your questions. Nevertheless, I'll answer some because the same
>> "problem" will arise with (upstream) trunk.
>>
>> Am 2017-12-26 23:37, schrieb Simone Atzeni via llvm-dev:
>>
>>> Hi,
>>>
>>> I am having some trouble to understand how the clang driver works
>>> for
>>> OpenMP offloading.
>>>
>>> For example, if I run the following command (with the -v flag):
>>>
>>> clang -v -g -fopenmp offloading_success.c -o offloading_success
>>>
>>> I can see the invocations that clang does and if I run those
>>> command
>>> one by one I can successfully compile my program.
>>
>> Just to clarify: This will compile but will fallback to run on the
>> host because the arguments don't specify which device to compile
>> for.
>>
>>> Now, if I do the same but with the offloading option, as in the
>>> following command:
>>>
>>> clang -v -g -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
>>> offloading_success.c -o offloading_success
>>>
>>> the command works, compiles correctly, and when I run the program,
>>> it
>>> successfully run on the device.
>>
>> (which would not be the case for upstream trunk yet...)
>>
>>> However, if I show the invocations with "-v" and try to run the
>>> commands one by one it does not work and in particular I get an
>>> error
>>> with the last command which is the linking part with "ld".
>>> The error i get is the following:
>>>
>>> /usr/bin/ld: cannot open linker script file
>>> /tmp/offloading_success-2b4739.lk [1] [1]: No such file or
>>> directory
>>>
>>> Where is this ".lk" file generated? Is there a missing commands in
>>> the
>>> invocations?
>>
>> The linker script is generated by Clang's driver (both in clang-ykt
>> and trunk) and is deleted after its usage which is the default for
>> temporary files. If you want to inspect the intermediate files, I
>> suggest adding --save-temps which will dump a bunch of files to the
>> current directory. (AFAIK this will result in more files than
>> generated by default so that developers have more intermediate steps
>> to look at.)
>>
>> Cheers,
>> Jonas
>
>
>
> Links:
> ------
> [1] http://offloading_success-2b4739.lk
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev