From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zm-mta-out-3.u-ga.fr (zm-mta-out-3.u-ga.fr [152.77.200.56]) by sourceware.org (Postfix) with ESMTPS id ECC3E3858401 for ; Thu, 24 Aug 2023 07:40:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECC3E3858401 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=univ-grenoble-alpes.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=univ-grenoble-alpes.fr Received: from mailhub.u-ga.fr (mailhub-1.u-ga.fr [129.88.178.98]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id 713CE4021F; Thu, 24 Aug 2023 09:40:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=univ-grenoble-alpes.fr; s=2020; t=1692862842; bh=qW1PVJw+FHXUmUCaqG48tcPc5UzJVCKB6Cdf7AAiw7k=; h=Date:Subject:To:References:From:In-Reply-To:From; b=SCI7H+ueiHBOYWqaRn5cMTdMVbbx9DkS9qhDeIfJkigdU79lrKAlH1LpJAhENKCXz cb7o2vzp2K2479jy7L8N0Bot48oYOqW9e8prCP643ts3caTqnNFNomcCdvQKsKmnjw 1h459ovr00/NvYDgNeFX/tDoa8p3WoSx5cmsyh66Rffmu+6lXwhDnxAMoYX84NHAba qZ2+KWLy1sF+mSGUxw7X2/Phm4B/5poaIpnz0ejO/1bKrkLuH9ATyDHhjmimScytKM OurHZEqGFtMlfhwjU+2hXiu6nlhFYxcddJBapQS3fXO8TdHfhUJ1ZzoBHRj/umPAng rfXhVx4j/Cl0Q== Received: from smtps.univ-grenoble-alpes.fr (smtps2.u-ga.fr [152.77.18.2]) by mailhub.u-ga.fr (Postfix) with ESMTP id 6F26110005A; Thu, 24 Aug 2023 09:40:42 +0200 (CEST) Received: from [192.168.1.168] (82-64-214-7.subs.proxad.net [82.64.214.7]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: begoup@univ-grenoble-alpes.fr) by smtps.univ-grenoble-alpes.fr (Postfix) with ESMTPSA id 4D2D6140052; Thu, 24 Aug 2023 09:40:42 +0200 (CEST) Message-ID: Date: Thu, 24 Aug 2023 09:40:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: Help with fortran pointer ans OpenACC Content-Language: fr, en-GB To: Tobias Burnus , fortran@gcc.gnu.org References: <1c45183d-cd8f-8672-d9b1-95a59314c51b@univ-grenoble-alpes.fr> <9cace080-44e8-6cbd-df7e-6fcbc02bee33@codesourcery.com> From: Patrick Begou In-Reply-To: <9cace080-44e8-6cbd-df7e-6fcbc02bee33@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Whitelist-UGA SMTP Authentifie (begoup@univ-grenoble-alpes.fr) via submission-587 ACL (42) X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Tobias, many thanks for all these informations! - I confirm, this clause solve the problem with GNU Fortran - This workaround is fully compatible with Nvidia Fortran - The problem with Cray Fortran remains (with this compiler, the test-case runs but the result is wrong) I've tested the suggested options for debugging but I must admit that these intermediates files are a little bit out of my knowledge level to easily identify the problem. In my work, portability is important and I have access to different compilers and GPU architectures and may be my best contribution to GNU software is limited to these tests and reports with small test-cases from a large scientific code that is expected to run on most GPU with various compilers. Thanks again for your help and detailed explanation Patrick Le 23/08/2023 à 13:41, Tobias Burnus a écrit : > Hi, > > On 23.08.23 12:19, Patrick Begou via Fortran wrote: >> For several days I have some trouble with OpenACC offloading and >> fortran pointers. I'm testing with a very small peace of code to >> investigate but I do not progress for several days and I need your help. >> >> Could someone give me advices or a small explanation on what I have >> not understood there ? > > First, for debugging, using -fdump-tree-original -fdump-tree-gimple > -fdump-tree-omplower and looking at the file .* might > help - grep for '#pragma'; this shows the internal representation > (incomplete) in a C like output. That's how I spotted the issue below. > > * * * > > For gfortran, the issue is: > >         !$acc parallel loop collapse(2) default(present) if(runongpu) > > It works if you add a "present(current)" → see also newly filed > https://gcc.gnu.org/PR111116 > > gfortran seems to follow - but not completely - the spec: > > Quoting from OpenACC 3.2: "2.6.2 Variables with Implicitly Determined > Data Attributes": > > "A scalar variable will be treated as if it appears either: > > * In a copy clause if the compute construct is a kernels construct. > * In a firstprivate clause otherwise. > > Note: Any default(none) clause visible at the compute construct applies > to both aggregate and scalar variables. However, any default(present) > clause visible at the compute construct applies only to aggregate > variables." > > However, the glossary defines: > > "Aggregate variables – a variable of any non-scalar datatype, including > array or composite variables. > In Fortran, this includes any variable with allocatable or pointer > attribute and character variables." > > And, as you have a (scalar) Fortran pointer, the following should have > applied instead: > > "An aggregate variable will be treated as if it appears either: > • In a present clause if there is a default(present) clause visible at > the compute construct. > • In a copy clause otherwise." > > * * * > > Thus: It looks as if your program is valid, adding 'present(current)' > will fix it for gfortran (and Cray?), 'default(...)' and implicit > mapping is confusing, and there is now a gfortran PR to track this > issue: https://gcc.gnu.org/PR111116 > > Tobias > > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße > 201, 80634 München; Gesellschaft mit beschränkter Haftung; > Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: > München; Registergericht München, HRB 106955