Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #8790. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
- Loading branch information
1 parent
f5ef735
commit 4644642
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class Opencoarrays < Formula | ||
desc "open-source coarray Fortran ABI, API, and compiler wrapper" | ||
homepage "http://opencoarrays.org" | ||
url "https://github.com/sourceryinstitute/opencoarrays/releases/download/1.8.2/OpenCoarrays-1.8.2.tar.gz" | ||
sha256 "dc5b98a62de85e38500f431b05290415d4a4a87001c0ba03fbe57403ad62010b" | ||
|
||
head "https://github.com/sourceryinstitute/opencoarrays.git" | ||
|
||
option "without-test", "Skip build time tests (not recommended)" | ||
|
||
depends_on "gcc" | ||
depends_on :fortran | ||
depends_on :mpi => :cc | ||
depends_on "cmake" => :build | ||
|
||
def install | ||
mkdir "build" do | ||
system "cmake", "..", *std_cmake_args | ||
system "make" | ||
system "ctest", "--output-on-failure", "--schedule-random" if build.with? "test" | ||
system "make", "install" | ||
end | ||
end | ||
|
||
test do | ||
ENV.fortran | ||
(testpath/"tally.f90").write <<-EOS.undent | ||
program main | ||
use iso_c_binding, only : c_int | ||
use iso_fortran_env, only : error_unit | ||
implicit none | ||
integer(c_int) :: tally | ||
tally = this_image() ! this image's contribution | ||
call co_sum(tally) | ||
verify: block | ||
integer(c_int) :: image | ||
if (tally/=sum([(image,image=1,num_images())])) then | ||
write(error_unit,'(a,i5)') "Incorrect tally on image ",this_image() | ||
error stop 2 | ||
end if | ||
end block verify | ||
! Wait for all images to pass the test | ||
sync all | ||
if (this_image()==1) write(*,*) "Test passed" | ||
end program | ||
EOS | ||
system "#{bin}/caf", "tally.f90", "-o", "tally" | ||
system "#{bin}/cafrun", "-np", "3", "./tally" | ||
end | ||
end |