This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
add mpi4py and its friends #534
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c71e97f
port mpi dependencies from conda-forge feedstock
leofang dc5ed77
added tests for mpi
leofang 6784aaa
added links to the conda-forge feedstock counterparts
leofang b7a6ff8
added LICENSE for mpi
leofang eff861a
fixed permission to pass tests
leofang 8acc6ee
added mpi4py
leofang c6a26c9
added a condition to avoid compiler error
leofang c06b574
added build requirement and updated mpi4py test
leofang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,13 @@ | ||
BSD 3-clause license | ||
Copyright (c) conda-forge | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,6 @@ | ||
# Copied and pasted by Leo Fang from the following commit: | ||
# https://github.com/conda-forge/mpi-feedstock/blob/0d45405585f31b51d9b4957f01613ae2f336a0c0/recipe/conda_build_config.yaml | ||
|
||
mpi: | ||
- openmpi | ||
- mpich |
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,40 @@ | ||
# Copied and pasted by Leo Fang from the following commit: | ||
# https://github.com/conda-forge/mpi-feedstock/blob/0d45405585f31b51d9b4957f01613ae2f336a0c0/recipe/meta.yaml | ||
|
||
# Based on blas metapackage: https://github.com/conda-forge/blas-feedstock | ||
# Some useful notes can be found at https://conda-forge.hackpad.com/BLAS-Numpy-Friends-86De62hoNdT | ||
# See discussion: https://github.com/conda-forge/staged-recipes/pull/1501 | ||
|
||
# The version should be in the form X.Y, where X denotes major infrastructural change to how mpi is managed, | ||
# and Y denoting mpi priority. Having MPI priority causes `conda upgrade --all` to switch to preferred provider, | ||
# so currently express no priority. | ||
{% set Y = 0 %} | ||
package: | ||
name: mpi | ||
version: 1.{{ Y }} | ||
|
||
build: | ||
# We mustn't use the build number in the mpi package - because we are defining the string, | ||
# manually we would not be producing unique filenames. | ||
number: 0 | ||
string: {{ mpi }} | ||
# TODO: support Windows when msmpi is packaged | ||
skip: true # [win] | ||
|
||
requirements: {} | ||
# None, mpi providers should depend on me | ||
|
||
test: | ||
commands: | ||
- echo "I'm a metapackage" | ||
|
||
about: | ||
home: https://github.com/conda-forge/mpi-feedstock | ||
license: BSD 3-clause | ||
license_file: {{ RECIPE_DIR if RECIPE_DIR is defined else '' }}/LICENSE.txt | ||
summary: Metapackage to select the MPI variant. Use conda's pinning mechanism in your environment to control which variant you want. | ||
|
||
extra: | ||
recipe-maintainers: | ||
- minrk | ||
- ocefpaf |
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,10 @@ | ||
# copied and pasted by Leo Fang from the following commit: | ||
# https://github.com/conda-forge/mpi4py-feedstock/blob/ff2cc11800303988538b8ce3e9707ea97d5bdd2e/recipe/conda_build_config.yaml | ||
|
||
mpi: | ||
- openmpi | ||
- mpich | ||
|
||
pin_run_as_build: | ||
mpich: x.x | ||
openmpi: x.x |
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,54 @@ | ||
# Copied and pasted by Leo Fang from the following commit: | ||
# https://github.com/conda-forge/mpi4py-feedstock/blob/ff2cc11800303988538b8ce3e9707ea97d5bdd2e/recipe/meta.yaml | ||
|
||
{% set build = 1004 %} | ||
{% set version = '3.0.0' %} | ||
{% set sha256 = 'b457b02d85bdd9a4775a097fac5234a20397b43e073f14d9e29b6cd78c68efd7' %} | ||
|
||
package: | ||
name: mpi4py | ||
version: {{ version }} | ||
|
||
source: | ||
fn: mpi4py-{{ version }}.tar.gz | ||
url: https://bitbucket.org/mpi4py/mpi4py/downloads/mpi4py-{{ version }}.tar.gz | ||
sha256: {{ sha256 }} | ||
|
||
build: | ||
number: {{ build }} | ||
script: pip install --no-deps . | ||
# TODO: build with msmpi when it works | ||
skip: true # [win] | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
host: | ||
- python | ||
- pip | ||
- {{ mpi }} | ||
run: | ||
- python | ||
- {{ mpi }} | ||
|
||
test: {} | ||
|
||
about: | ||
home: http://mpi4py.scipy.org/ | ||
license: BSD 2-clause | ||
license_family: BSD | ||
license_file: LICENSE.rst | ||
summary: Python bindings for MPI | ||
description: | | ||
MPI for Python provides bindings of the Message Passing Interface (MPI) | ||
standard for the Python programming language, allowing any Python program | ||
to exploit multiple processors. | ||
doc_url: https://mpi4py.readthedocs.org/ | ||
dev_url: https://bitbucket.org/mpi4py/mpi4py | ||
|
||
extra: | ||
recipe-maintainers: | ||
- dalcinl | ||
- minrk | ||
- msarahan | ||
- ocefpaf |
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,8 @@ | ||
# copied and pasted by Leo Fang from the following commit: | ||
# https://github.com/conda-forge/mpi4py-feedstock/blob/ff2cc11800303988538b8ce3e9707ea97d5bdd2e/recipe/run_test.sh | ||
|
||
export OMPI_MCA_plm=isolated | ||
export OMPI_MCA_btl_vader_single_copy_mechanism=none | ||
export OMPI_MCA_rmaps_base_oversubscribe=yes | ||
|
||
python -c 'import mpi4py; from mpi4py import MPI; print(MPI.get_vendor()); print(MPI.Get_library_version())' |
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 @@ | ||
# copied and pasted by Leo Fang from the following commit: | ||
# https://github.com/conda-forge/mpich-feedstock/blob/1ee1a927c03fd9653313c1cdd79bea87ef5ef16a/recipe/build.sh | ||
|
||
#!/bin/bash | ||
|
||
# configure balks if F90 is defined | ||
# with a fatal deprecation message pointing to FC | ||
unset F90 F77 | ||
|
||
# remove --as-needed, which causes problems for downstream builds, | ||
# seen in failures in petsc, slepc, and hdf5 at least | ||
export LDFLAGS="${LDFLAGS/-Wl,--as-needed/}" | ||
|
||
# avoid absolute-paths in compilers | ||
export CC=$(basename "$CC") | ||
export CXX=$(basename "$CXX") | ||
export FC=$(basename "$FC") | ||
|
||
# from anaconda recipe, not sure if it matters | ||
export FCFLAGS="$FFLAGS" | ||
|
||
# avoid recording flags in compilers | ||
# See Compiler Flags section of MPICH readme | ||
export MPICHLIB_CFLAGS=$CFLAGS | ||
unset CFLAGS | ||
export MPICHLIB_CXXFLAGS=$CXXFLAGS | ||
unset CXXFLAGS | ||
export MPICHLIB_LDFLAGS=$LDFLAGS | ||
unset LDFLAGS | ||
export MPICHLIB_FFLAGS=$FFLAGS | ||
unset FFLAGS | ||
export MPICHLIB_FCFLAGS=$FCFLAGS | ||
unset FCFLAGS | ||
|
||
# set some specific flags that we *do* want recorded in the compilers | ||
# only the bare minimum of prefix-awareness here | ||
export CFLAGS="-I$PREFIX/include" | ||
export CXXFLAGS="-I$PREFIX/include" | ||
export FFLAGS="-I$PREFIX/include" | ||
export LDFLAGS="-L$PREFIX/lib -Wl,-rpath,$PREFIX/lib" | ||
|
||
export LIBRARY_PATH="$PREFIX/lib" | ||
|
||
./configure --prefix=$PREFIX \ | ||
--disable-dependency-tracking \ | ||
--enable-cxx \ | ||
--enable-fortran | ||
|
||
make -j"${CPU_COUNT:-1}" | ||
make install |
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,64 @@ | ||
# copied and pasted by Leo Fang from the following commit: | ||
# https://github.com/conda-forge/mpich-feedstock/blob/1ee1a927c03fd9653313c1cdd79bea87ef5ef16a/recipe/meta.yaml | ||
|
||
{% set version = "3.2.1" %} | ||
|
||
package: | ||
name: mpich | ||
version: {{ version }} | ||
|
||
source: | ||
fn: mpich-{{ version }}.tar.gz | ||
url: http://www.mpich.org/static/downloads/{{ version }}/mpich-{{ version }}.tar.gz | ||
sha256: 5db53bf2edfaa2238eb6a0a5bc3d2c2ccbfbb1badd79b664a1a919d2ce2330f1 | ||
|
||
build: | ||
number: 1007 | ||
skip: True # [win] | ||
run_exports: | ||
- {{ pin_subpackage('mpich', min_pin='x.x', max_pin='x.x') }} | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- {{ compiler('cxx') }} | ||
- {{ compiler('fortran') }} | ||
- conda-build >=3.17.0 | ||
host: [] | ||
run: | ||
- mpi 1.0 mpich | ||
|
||
test: | ||
requires: | ||
- {{ compiler('c') }} | ||
- {{ compiler('cxx') }} | ||
- {{ compiler('fortran') }} | ||
files: | ||
- tests/helloworld.c | ||
- tests/helloworld.cxx | ||
- tests/helloworld.f | ||
- tests/helloworld.f90 | ||
commands: | ||
- conda inspect objects mpich # [osx] | ||
- conda inspect linkages mpich # [not win] | ||
|
||
about: | ||
home: http://www.mpich.org/ | ||
license: MPICH | ||
license_file: COPYRIGHT | ||
license_family: Other | ||
summary: 'A high performance widely portable implementation of the MPI standard.' | ||
description: | | ||
MPICH is a high performance and widely portable implementation of the | ||
Message Passing Interface (MPI) standard. | ||
doc_url: http://www.mpich.org/documentation/guides | ||
dev_url: https://wiki.mpich.org/mpich/index.php/Main_Page | ||
|
||
extra: | ||
recipe-maintainers: | ||
- astrofrog-conda-forge | ||
- bekozi | ||
- dalcinl | ||
- minrk | ||
- msarahan | ||
- ocefpaf |
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,38 @@ | ||
#!/bin/bash | ||
# copied and pasted by Leo Fang from the following commit: | ||
# https://github.com/conda-forge/mpich-feedstock/blob/1ee1a927c03fd9653313c1cdd79bea87ef5ef16a/recipe/run_test.sh | ||
|
||
command -v mpichversion | ||
mpichversion | ||
|
||
command -v mpicc | ||
mpicc -show | ||
|
||
command -v mpicxx | ||
mpicxx -show | ||
|
||
command -v mpif90 | ||
mpif90 -show | ||
|
||
command -v mpiexec | ||
|
||
pushd tests | ||
|
||
function mpi_exec() { | ||
# use pipes to avoid O_NONBLOCK issues on stdin, stdout | ||
mpiexec -launcher fork $@ 2>&1 </dev/null | cat | ||
} | ||
|
||
mpicc $CFLAGS $LDFLAGS helloworld.c -o helloworld_c | ||
mpi_exec -n 4 ./helloworld_c | ||
|
||
mpicxx $CXXFLAGS $LDFLAGS helloworld.cxx -o helloworld_cxx | ||
mpi_exec -n 4 ./helloworld_cxx | ||
|
||
mpif77 $FFLAGS $LDFLAGS helloworld.f -o helloworld_f | ||
mpi_exec -n 4 ./helloworld_f | ||
|
||
mpif90 $FFLAGS $LDFLAGS helloworld.f90 -o helloworld_f90 | ||
mpi_exec -n 4 ./helloworld_f90 | ||
|
||
popd |
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,19 @@ | ||
#include <mpi.h> | ||
#include <stdio.h> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
int provided, size, rank, len; | ||
char name[MPI_MAX_PROCESSOR_NAME]; | ||
|
||
MPI_Init(&argc, &argv); | ||
|
||
MPI_Comm_size(MPI_COMM_WORLD, &size); | ||
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | ||
MPI_Get_processor_name(name, &len); | ||
|
||
printf("Hello, World! I am process %d of %d on %s.\n", rank, size, name); | ||
|
||
MPI_Finalize(); | ||
return 0; | ||
} |
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,22 @@ | ||
#include <mpi.h> | ||
#include <iostream> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
MPI::Init(); | ||
|
||
int size = MPI::COMM_WORLD.Get_size(); | ||
int rank = MPI::COMM_WORLD.Get_rank(); | ||
int len; char name[MPI_MAX_PROCESSOR_NAME]; | ||
MPI::Get_processor_name(name, len); | ||
|
||
std::cout << | ||
"Hello, World! " << | ||
"I am process " << rank << | ||
" of " << size << | ||
" on " << name << | ||
"." << std::endl; | ||
|
||
MPI::Finalize(); | ||
return 0; | ||
} |
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,21 @@ | ||
program main | ||
|
||
include 'mpif.h' | ||
|
||
integer ierr, rank, size, len | ||
character name*(MPI_MAX_PROCESSOR_NAME) | ||
|
||
call MPI_INIT(ierr) | ||
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr) | ||
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr) | ||
call MPI_GET_PROCESSOR_NAME(name, len, ierr) | ||
|
||
print '(2A,I2,A,I2,3A)', | ||
& 'Hello, World! ', | ||
& 'I am process ', rank, | ||
& ' of ', size, | ||
& ' on ', trim(name), '.' | ||
|
||
call MPI_FINALIZE(ierr) | ||
|
||
end |
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,23 @@ | ||
program main | ||
|
||
use mpi | ||
implicit none | ||
|
||
integer :: provided, ierr, size, rank, len | ||
character (len=MPI_MAX_PROCESSOR_NAME) :: name | ||
|
||
call MPI_Init(ierr) | ||
|
||
call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr) | ||
call MPI_Comm_size(MPI_COMM_WORLD, size, ierr) | ||
call MPI_Get_processor_name(name, len, ierr) | ||
|
||
write(*, '(2A,I2,A,I2,3A)') & | ||
'Hello, World! ', & | ||
'I am process ', rank, & | ||
' of ', size, & | ||
' on ', name(1:len), '.' | ||
|
||
call MPI_Finalize(ierr) | ||
|
||
end program main |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Good point! I tried to rebuild the Docker image for
nsls2/debian-with-miniconda
with the newer version of conda-build, but it failed on some strange error. Will retry it later today. Anyway, your addition will fix it for now.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.
No problem. Is the docker image new as of now? I just tried building this commit with it and it works fine.
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.
No, it wasn't updated to have
conda-build >=3.17.0
, however it's a good practice to have this dependency explicitly. I'll try to rebuild our image so that we have the updated version of conda-build out-of-the-box.