From: Chung-Lin Tang <chunglin_tang@mentor.com>
To: "Maciej W. Rozycki" <macro@codesourcery.com>,
Chung-Lin Tang <cltang@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>,
Thomas Schwinge <thomas@codesourcery.com>,
Jakub Jelinek <jakub@redhat.com>,
Catherine Moore <clm@codesourcery.com>,
Tom de Vries <tdevries@suse.de>
Subject: Re: [PATCH, og8] Add OpenACC 2.6 `acc_get_property' support
Date: Mon, 10 Dec 2018 09:06:00 -0000 [thread overview]
Message-ID: <ae40a083-e7b0-5172-4223-646ff5476cff@mentor.com> (raw)
In-Reply-To: <alpine.DEB.2.21.9999.1812051816520.75469@build7-trusty-cs.sje.mentorg.com>
On 2018/12/6 2:16 AM, Maciej W. Rozycki wrote:
>> AFAIK, things like strlen are already available in iso_c_binding, in forms
>> like "C_strlen".
>> Can you check again if that 'openacc_c_string' module is really necessary?
> Any pointers please?
>
> I can't see `c_strlen' or any equivalent interface defined either in the
> Fortran 2003 language standard or in GCC documentation, and neither `grep'
> over the GCC tree shows anything relevant. The `iso_c_binding' module
> defines only a bunch of procedures according to said documentation. The
> `strlen' function provided here has been taken from one of our Fortran
> test cases, which strongly indicates there's no such API already available
> or whoever wrote the test case would have chosen to use it I suppose.
Okay I see. I think I mixed up the common convention with the actual interface
standard.
>>> + CUcontext new_ctx;
>>> +
>>> + CUDA_CALL_ERET (propval, cuCtxCreate, &new_ctx, CU_CTX_SCHED_AUTO,
>>> + dev);
>>> + CUDA_CALL_ERET (propval, cuMemGetInfo, &free_mem, &total_mem);
>>> + CUDA_CALL_ASSERT (cuCtxDestroy, new_ctx);
>>> + }
>> (I'm CCing Tom here, as he is maintainer for these parts)
>>
>> As we discussed earlier on our internal list, I think properly using
>> GOMP_OFFLOAD_init_device
>> is the right way, instead of using the lower level CUDA context
>> create/destroy.
>>
>> I did not mean for you to first init the device and then immediately destroy
>> it by
>> GOMP_OFFLOAD_fini_device, just to obtain the property, but for you to just
>> take the opportunity to initialize
>> it for use, and leave it there until program exit. That should save resources
>> overall.
>> (BTW, CUDA contexts should be quite expensive to create/destroy, using a
>> cuCtxCreate/Destroy pair is probably
>> almost as slow)
> I have argued that this looks like a corner-case use case to me, as
> querying for the remaining (rather than total) memory available to a
> device that hasn't been (yet) used looks like of hardly any use to me,
> because obviously at such a stage no memory has been used. The OpenACC
> standard does require us to handle such a request somehow, with returning
> 0 being another option, however I thought we may well have a quick peek
> without pulling in all the state.
>
> I guess I have no strong opinion either way and I can adapt accordingly.
>
> NB that would have to be `gomp_init_device' rather than
> `GOMP_OFFLOAD_init_device' AFAICS.
You'll have to use GOMP_OFFLOAD_init_device, as you are inside the plugin, gomp_init_device()
should not be available.
However, looking into this further, the checking conventions of GOMP_OFFLOAD_init_device
will have to be slightly tweaked to accommodate possible further initing from libgomp proper,
so this may requirement a longer string of changes...I think it's not worth it, or can
be adjusted later. I now think your current approach with the CUDA contexts is okay.
I think the patch is okay, although still needs approval from Thomas and Tom to commit.
Thanks,
Chung-Lin
next prev parent reply other threads:[~2018-12-10 9:06 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 16:51 Maciej W. Rozycki
2018-12-05 10:12 ` Chung-Lin Tang
2018-12-05 18:17 ` Maciej W. Rozycki
2018-12-10 9:06 ` Chung-Lin Tang [this message]
2018-12-20 14:25 ` Maciej W. Rozycki
2019-01-08 17:42 ` Thomas Schwinge
2019-10-07 18:41 ` Thomas Schwinge
2019-11-05 15:09 ` Harwath, Frederik
2019-11-14 15:41 ` [PATCH] " Frederik Harwath
2019-12-16 23:06 ` Thomas Schwinge
2019-12-17 9:39 ` Martin Jambor
2019-12-17 9:47 ` Andrew Stubbs
2019-12-20 17:11 ` Harwath, Frederik
2019-12-21 23:01 ` Thomas Schwinge
2019-12-22 22:20 ` Harwath, Frederik
2020-01-10 23:44 ` Thomas Schwinge
2020-01-30 16:14 ` Make OpenACC 'acc_get_property' with 'acc_device_current' work (was: [PATCH] Add OpenACC 2.6 `acc_get_property' support) Thomas Schwinge
2020-02-03 12:16 ` Harwath, Frederik
2020-02-03 14:41 ` Make OpenACC 'acc_get_property' with 'acc_device_current' work Tobias Burnus
2020-01-16 16:03 ` [PATCH] Add OpenACC 2.6 `acc_get_property' support Thomas Schwinge
2020-01-20 14:20 ` Harwath, Frederik
2020-01-23 15:08 ` Thomas Schwinge
2020-01-24 9:36 ` Harwath, Frederik
2020-01-27 14:57 ` Fortran 'acc_get_property' return type (was: [PATCH] Add OpenACC 2.6 `acc_get_property' support) Thomas Schwinge
2020-01-28 15:31 ` [PATCH] Add OpenACC acc_get_property support for AMD GCN Harwath, Frederik
2020-01-28 16:14 ` Andrew Stubbs
2020-01-29 10:10 ` Harwath, Frederik
2020-01-29 11:07 ` Andrew Stubbs
2020-01-29 11:47 ` Harwath, Frederik
2020-01-29 17:58 ` Thomas Schwinge
2020-01-29 18:12 ` Andrew Stubbs
2020-01-30 8:04 ` Harwath, Frederik
2020-01-30 16:28 ` Thomas Schwinge
2020-01-30 16:54 ` Andrew Stubbs
2020-01-31 9:32 ` Thomas Schwinge
2020-01-31 12:32 ` Harwath, Frederik
2020-01-31 14:49 ` Thomas Schwinge
2020-04-29 9:19 ` [PATCH] Add OpenACC 2.6 `acc_get_property' support Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ae40a083-e7b0-5172-4223-646ff5476cff@mentor.com \
--to=chunglin_tang@mentor.com \
--cc=clm@codesourcery.com \
--cc=cltang@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=macro@codesourcery.com \
--cc=tdevries@suse.de \
--cc=thomas@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).