-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Experimental fpm build #753
base: main
Are you sure you want to change the base?
Conversation
git mv test tests
The script 1. Installs OpenMPI via homebrew if mpifort is missing. 2. Builds libopencoarrays.a library. 3. Runs a parallel "Hello, world!" program in four images.
This commit eliminates the hardwired, separate build and run steps in run-fpm.sh and instead passes an command-line arguments along to fpm. The following now works even with no prior build directory present: ./run-fpm.sh --example hello
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the CMake changes, but I made some comments on the install script.
echo "For a non-interactive build with the 'yes' utility installed, execute" | ||
echo "yes | ./install.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I'd include this. There are too many scenarios where this won't work. For example, if homebrew asks for sudo
access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@everythingfunctional I was going to remove this, but decided to keep it because it relates to a user request. I think I can borrow code from the original installer to cover the case in which sudo
is required.
--c-flag "-DPREFIX_NAME=_gfortran_caf_ -DGCC_GE_7 -DGCC_GE_8" \ | ||
--flag "-fcoarray=lib" | ||
|
||
CAF_VERSION=$(sed -n '/[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}/{s/^\([^.]*\)\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)\(.*\)/\2/p;q;}' .VERSION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regular expression deserves an explanatory comment I think.
install.sh
Outdated
if [ -z ${MPIFC+x} ] || [ -z ${MPICC+x} ]; then | ||
ask_permission_to_install_homebrew_package "'mpifort' and 'mpicc'" "open-mpi" | ||
exit_if_user_declines "mpifort and mpicc" | ||
"$BREW" install gcc@$GCC_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the following error from mpicc
installed with homebrew on Linux
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
gcc-5 in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
--------------------------------------------------------------------------
<ERROR> Compilation failed for object " example_hello.f90.o "
<ERROR>stopping due to failed compilation
install.sh
Outdated
$FPM install \ | ||
--compiler $FPM_FC \ | ||
--c-compiler $FPM_CC \ | ||
--c-flag "-DPREFIX_NAME=_gfortran_caf_ -DGCC_GE_7 -DGCC_GE_8" \ | ||
--flag "-fcoarray=lib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the following error from this on Linux.
+ /usr/bin/mpicc -c ./src/mpi-runtime/mpi_caf.c -DPREFIX_NAME=_gfortran_caf_ -DGCC_GE_7 -DGCC_GE_8 -o build/mpifort_EA4E6F5B6A428512/opencoarrays/src_mpi-runtime_mpi_caf.c.o
./src/mpi-runtime/mpi_caf.c:46:10: fatal error: mpi.h: No such file or directory
46 | #include <mpi.h>
| ^~~~~~~
compilation terminated.
install.sh
Outdated
sed -i '' -e "s/@Fortran_COMPILER@/$Fortran_COMPILER/g" "$PREFIX"/bin/caf | ||
sed -i '' -e "s/@CAF_LIBS@/lib\/libopencoarrays.a/g" "$PREFIX"/bin/caf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure these sed
commands have to have -i''
(without the space) or just -i
on Linux.
run-fpm.sh
Outdated
fpm $@ \ | ||
--compiler `which mpifort` \ | ||
--c-compiler `which mpicc` \ | ||
--c-flag "-DPREFIX_NAME=_gfortran_caf_ -DGCC_GE_7 -DGCC_GE_8" \ | ||
--flag "-fcoarray=lib" \ | ||
--runner "mpirun -n 4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the idea that this is the fpm command to be used if one wants to make use of OpenCoarrays? If so, shouldn't there be a flag that points to the installed opencoarrays library?, or is the idea that it would be listed in the project's fpm.toml
file and thus downloaded and compiled by fpm with those flags?
Co-authored-by: Brad Richardson <[email protected]>
Co-authored-by: Brad Richardson <[email protected]>
image_numbers = [(merge(0, me, me/=i), i = 1, ni)] | ||
call co_sum(image_numbers) | ||
result_ = assert_that(all(image_numbers == [(i, i = 1, ni)]) .and. size(image_numbers)>0, "correct image set") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a "clever trick", and as such deserves better explanation. There might be a way to make the code more clear, but I'd settle for an explanatory comment.
Summary of changes
fpm
manifist: fpm.toml.run-fpm.sh
script for building with fpm.To Do
install.sh
with an installer based the [Caffeine] installer and the newrun-fpm.sh
script.Rationale for changes
fpm
manifest so simple to maintain that it's reasonable to support two build systems.Additional info and certifications
This pull request (PR) is a:
I certify that
OpenCoarrays developer a chance to review my proposed code
be introduced)
Code coverage data