From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27893 invoked by alias); 15 Apr 2016 08:36:16 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 27775 invoked by uid 89); 15 Apr 2016 08:36:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=pgi, offer, our, interest X-HELO: mail-oi0-f50.google.com Received: from mail-oi0-f50.google.com (HELO mail-oi0-f50.google.com) (209.85.218.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 15 Apr 2016 08:35:48 +0000 Received: by mail-oi0-f50.google.com with SMTP id y204so117802833oie.3 for ; Fri, 15 Apr 2016 01:35:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=kPtIPjFcVb9lpispbUUsQJgTit/dAMT/hThpTn13xBk=; b=VfTFgIKgxNlqF+uBZrUmmrjPvYhHt8tMoUg6GCADZL7/HpYBkJdNCVlpa49HRYQ0lS WxzTVDTy3hfO/2zzvmYRV54TcA+b0VbJ4loXXnjkOac7DEJHtoDNWRFnjEYZBl8YKyjc ymiyciMeZiShC+ZyZuyJqBda2uTyTcf5fgh2d7TQ81AdR7827/vcD6XaIhUcz6JyYuYT 6OaVqRFt+fJp6OS7slrsV+qLwYiyzWxFyKEJA0A2BIFfoz3NbQMuOFMAVn3I4/a8M8Fg JNHeGK/Kx2eE1RR3Rg88pJiZ0PyFaZOaE0bsCdAzDrRtnbKzf8LxxDWJk2HTtzO6n34A EHog== X-Gm-Message-State: AOPr4FVxeoCxzRg0dl8X01tMbuhBIfl2QhOOGTZniplKhPoeayrAvP2nu3vhjw4DaGmIGK81dYxRgBBxbtzSeQ== X-Received: by 10.202.170.135 with SMTP id t129mr8986562oie.60.1460709345489; Fri, 15 Apr 2016 01:35:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.135 with HTTP; Fri, 15 Apr 2016 01:35:06 -0700 (PDT) In-Reply-To: <8737qn5rd4.fsf@kepler.schwinge.homeip.net> References: <8737qn5rd4.fsf@kepler.schwinge.homeip.net> From: Vikram Singh Date: Fri, 15 Apr 2016 08:36:00 -0000 Message-ID: Subject: Re: OpenACC-Library-Interoperability To: Thomas Schwinge Cc: James Norris , Chung-Lin Tang , fortran@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-04/txt/msg00049.txt.bz2 Hi Thomas. Thanks for the reply. Yes, I came to the conclusion that host_data would be the only way to do it in fortran. On the other hand, I though there were no plans to implement it in gfortran 6 either, so I pivoted back to using PGI compilers which I had originally not wanted to do. > I'm copying Jim, who is the author of this chapter in the documentation > as well as the libgomp/testsuite/libgomp.oacc-c-c++-common/context-*.c > test cases, and much of the relevant libgomp code, too, and who should > please correct me if I'm wrong. I'll make a note for later, that we > should translate the libgomp.oacc-c-c++-common/context-*.c test cases to > Fortran, and also replicate them using the OpenACC host_data construct > (like in libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c), and > the same for the documentation you referenced. (Vikram, please tell if > you're interested to work on these items.) I am not sure I understand what you want me to work on exactly. I am not really much of a C programmer, so I wouldn't be good at it. I would still like to help. Thanks and Regards, Vikram On Fri, Apr 15, 2016 at 9:16 AM, Thomas Schwinge wrote: > Hi! > > On Tue, 12 Apr 2016 18:00:02 +0300, Vikram Singh wrote: >> We have a project that is written in gfortran. >> >> I am trying to see whether we could use OpenACC in our project. > > Thanks for your interest! > >> I got >> gcc5.2 installed > > I will just note that the upcoming GCC 6 releases will offer much > extended support for OpenACC with nvptx offloading. (If you're building > GCC from sources anyway, you may want to give the current GCC trunk or > gomp-4_0-branch a try, after resolving the problem discussed below.) > >> using instructions here. >> >> https://github.com/olcf/OLCFHack15 > > Nice. > >> Now I want to do something similar to what is stated here. >> >> https://gcc.gnu.org/onlinedocs/libgomp/OpenACC-Library-Interoperability.= html >> >> More specifically what is stated in secion 8.3. I am trying to exactly >> reproduce it using gfortran. Unfortunately I don't see how I can do it >> in fortran. In the example, >> >> d_X =3D acc_copyin(&h_X[0], N * sizeof (float)); >> >> This allows d_X to be directly used in s =3D cublasSaxpy(h, N, &alpha, >> d_X, 1, d_Y, 1); >> >> But in fortran, the acc_copyin does not return anything. > > Correct. I'm not much of a Fortran programmer, but as far as I remember, > Fortran doesn't have a notion of a pointer as C/C++ have. I suppose > that's why the OpenACC specification defines that in Fortran, acc_copyin > et al. are subroutines (no return value) instead of functions, and why > acc_malloc, acc_deviceptr, acc_map et al. don't even exist in Fortran. > >> So how would I replicate the case in Fortran? > > You would use the OpenACC host_data construct. So, instead of: > > [...] > d_X =3D acc_copyin(&h_X[0], N * sizeof (float)); > [...] > s =3D cublasSaxpy(h, N, &alpha, d_X, 1, d_Y, 1); > [...] > > ... you would do something like (notice X instead of d_X and h_X) > (untested): > > [...] > acc_copyin(X, N * sizeof (float)); > [...] > #pragma acc host_data use_device(X) > { > s =3D cublasSaxpy(h, N, &alpha, X, 1, d_Y, 1); > } > [...] > > I'm copying Jim, who is the author of this chapter in the documentation > as well as the libgomp/testsuite/libgomp.oacc-c-c++-common/context-*.c > test cases, and much of the relevant libgomp code, too, and who should > please correct me if I'm wrong. I'll make a note for later, that we > should translate the libgomp.oacc-c-c++-common/context-*.c test cases to > Fortran, and also replicate them using the OpenACC host_data construct > (like in libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c), and > the same for the documentation you referenced. (Vikram, please tell if > you're interested to work on these items.) > > > ..., and now that've written all this, I think we have a show-stopper > here: as far as I remember, the OpenACC host_data construct is not yet > supported in the GCC 5 releases, and it's currently broken for Fortran, > too: (Chung-Lin if working on that). > > > Gr=C3=BC=C3=9Fe > Thomas