From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by sourceware.org (Postfix) with ESMTPS id CE1AD383301D; Fri, 18 Dec 2020 04:28:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CE1AD383301D Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.16.1/8.16.1) with ESMTPS id 0BI4SkHX094227 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 17 Dec 2020 20:28:46 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.16.1/8.16.1/Submit) id 0BI4SkvI094226; Thu, 17 Dec 2020 20:28:46 -0800 (PST) (envelope-from sgk) Date: Thu, 17 Dec 2020 20:28:46 -0800 From: Steve Kargl To: fortran@gcc.gnu.org Cc: kargl@gcc.gnu.org Subject: co-arrays and libgfortran Message-ID: <20201218042846.GA94181@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2020 04:29:06 -0000 Dear All, At the risk of causing consternation among the few active gfortran developers, I'll offer the observation that libgfortran likely need to be built with -fcoarray=lib if one wants to use OpenCoarrays. I'm not sure what the status of shared memory coarrays is. Why, you ask? J3 defined RANDOM_INIT() in a manner that requires it to be aware of the backing coarray communication method. That is, RANDOM_INIT(repeatable=.false., image_distinct=.false.) requires communication between image 1 and all other images (if num_image > 1). 'repeatable=.false.' means that each time a program is run, a different set of processor-dependent seeds are used on image 1. This is trivial to do with Janne's reworking of random_seed() when he introduce gfortran to xshiro++. Now, if num_images() > 1, then all other images are required to use the same set of seeds as image 1 to initial their PRNG. Therefore, the other images must ask image 1 for its seeds. I don't use co-arrays, so I'm unsure of the semantics; but, I have used MPI. With MPI, one would have image 1 broadcast the seeds and all other images would receive the seeds. Note, I've attached a patch that fixes random_init() for other combinations of repeatable and image_distinct (if anyone case) in https://gcc.gnu.org/pipermail/gcc-bugs/2020-December/723251.html -- Steve