51 lines
1.7 KiB
Ruby
51 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.3.1/OpenCoarrays-2.3.1.tar.gz"
|
|
sha256 "2b87cc8c31874ecb01e0300bc99b30e4017714fc0d17690f637d8fa4d48560f3"
|
|
head "https://github.com/sourceryinstitute/opencoarrays.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "da64bfe45566be340e0a998173d922d89453b0fd9c7ae3bef3629e1a7fded891" => :mojave
|
|
sha256 "ae71d4c445f5ed7e298dd05d82a92430f0c37ccfcded324ccbcfb74fbeb57bc0" => :high_sierra
|
|
sha256 "3b1ab0f8991aebde79c74bc2d859096c95a9195a3c7f40d44718e1173caa9f67" => :sierra
|
|
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", "--oversubscribe", "./tally"
|
|
end
|
|
end
|