Goddard-Fortran-Ecosystem / pFUnit

Parallel Fortran Unit Testing Framework
Other
172 stars 45 forks source link

Using MAX_PES as a variable for NPES #375

Closed nasa-ceporter closed 2 years ago

nasa-ceporter commented 2 years ago

Currently my unit tests have hard coded values of npes to test a single process and an arbitrary case with 4 processes.

   @test(npes=[1, 4])
   subroutine foo(this)
       integer :: bar
   end subroutine foo

Is there a way to touch MAX_PES somehow such that I can do something like this?

   @test(npes=[1, MAX_PES])
   subroutine foo(this)
       integer :: bar
   end subroutine foo
tclune commented 2 years ago

There is a kludge for this. If you specify a value of 0 it will attempt to use the number of processes in the "parent context". This will be the number of processes in MPI_COMM_WORLD unless you have done something particularly unusual. @test(npes=[1, 0]) subroutine foo(this) integer :: bar end subroutine foo

nasa-ceporter commented 2 years ago

That works for me! Thanks Tom. We in the GlennICE team at NASA GRC love the work here.