52 lines
1.7 KiB
Ruby
52 lines
1.7 KiB
Ruby
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/2.0.0/OpenCoarrays-2.0.0.tar.gz"
|
|
sha256 "996633f5f7563aa516e895817f26a43ef03c652d337972d64744e40dff343301"
|
|
revision 1
|
|
head "https://github.com/sourceryinstitute/opencoarrays.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "d3f99732d137a770765200130806d8f58a41b6c2eef3710b4ac4f56bd8ab1029" => :high_sierra
|
|
sha256 "4b2496cb331691f63a6a20e046b9fcb524d365f4b104fd278d7182254a2da3e8" => :sierra
|
|
sha256 "f431b6e31cb72f1b055fb904045a47f6a3d55396afe8307a628b8acf206bd0b7" => :el_capitan
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "gcc"
|
|
depends_on "open-mpi"
|
|
|
|
def install
|
|
mkdir "build" do
|
|
system "cmake", "..", *std_cmake_args
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"tally.f90").write <<~EOS
|
|
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
|