[flang-dev] iso_fortran_env and num_images() Questions

Timothy Keith via flang-dev flang-dev at lists.llvm.org
Mon Jun 15 12:41:25 PDT 2020


The predefined modules are defined in flang/module. These aren’t complete but there is a definition of TYPE_TYPE in ISO_FORTRAN_ENV. To make these available, run f18 with the option “-intrinsic-module-directory <build>/include/flang” or use the flang.sh wrapper which automatically adds that option.

That should allow you to write tests that use TEAM_TYPE. One example of a test that already does that is flang/test/Semantics/allocate11.f90. That checks that the SOURCE of an ALLOCATE statement does not have type TEAM_TYPE. You could write a semantics test that verifies that an error is reported if NUM_IMAGES is called with incorrect number or type of arguments. I don’t know how that compares to what is tested in flang/unittests/Evaluate/intrinsics.cpp because I’m not familiar with that.

Tim

From: flang-dev <flang-dev-bounces at lists.llvm.org> on behalf of Katherine Rasmussen via flang-dev <flang-dev at lists.llvm.org>
Reply-To: Katherine Rasmussen <ktrasmussn at gmail.com>
Date: Monday, June 15, 2020 at 11:28 AM
To: "flang-dev at lists.llvm.org" <flang-dev at lists.llvm.org>
Subject: [flang-dev] iso_fortran_env and num_images() Questions

External email: Use caution opening links or attachments

Hello,
    I am working for SourceryInstitute and trying to help implement coarrays in flang. I am working towards making a contribution to flang, the contribution being adding num_images() to the list of intrinsic functions that are evaluated by flang. Related to this goal, I have three questions:

First, has the intrinsic module iso_fortran_env been implemented yet? num_images() is an overloaded function and one of the variants takes a single scalar argument of type TEAM_TYPE. When I try to run f18 with the command line option -funparse-with-symbols on a file that has a num_images() call using the TEAM_TYPE argument and the following code:
     use iso_fortran_env, only : team_type
flang produces these errors:
    num_images4.f90:5:7: error: Error reading module file for module 'iso_fortran_env'
    num_images4.f90:5:7: Could not open 'iso_fortran_env.mod': No such file or directory

Should I ignore testing num_images() calls with teams or try and complete the iso_fortran_env module?

Second, after adding num_images() to the list of functions evaluated as intrinsic in the file flang/lib/Evaluate/intrinsics.cpp, I also edited the file flang/unittests/Evaluate/intrinsics.cpp. In that file, I wrote test calls to test the num_images() evaluation. I was able to test the variant of num_images() that has no parameters and the variant of num_images() that has the parameter 'team_number' of type integer. I was unable to figure out how to write a test call that tests the call with an argument of TEAM_TYPE. Is there anyone who can direct me towards figuring this out?

And last, in addition to adding num_images() test calls to the unittests/Evaluate/intrinsics.cpp, are there other tests I should write for the patch I would like to submit to llvm to contribute?

The flang files I have edited (flang/lib/Evaluate/intrinsics.cpp and flang/unittests/Evaluate/intrinsics.cpp) can be found in the develop-coarrays branch of sourcery-institute's fork of llvm-project
https://github.com/sourceryinstitute/flang-coarrays/blob/develop-coarrays/flang/lib/Evaluate/intrinsics.cpp
https://github.com/sourceryinstitute/flang-coarrays/blob/develop-coarrays/flang/unittests/Evaluate/intrinsics.cpp

I am also attaching the test file with calls to num_images() that I was using to test what symbols were being created, this is the file that creates the error messages described above.

Thank you for your time and help,
     Kate Rasmussen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20200615/7644c5c9/attachment.html>


More information about the flang-dev mailing list