Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

add mpi4py and its friends #534

Merged
merged 8 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions recipes-tag/mpi/LICENSE.txt
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.
6 changes: 6 additions & 0 deletions recipes-tag/mpi/conda_build_config.yaml
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
40 changes: 40 additions & 0 deletions recipes-tag/mpi/meta.yaml
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
10 changes: 10 additions & 0 deletions recipes-tag/mpi4py/conda_build_config.yaml
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
54 changes: 54 additions & 0 deletions recipes-tag/mpi4py/meta.yaml
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
8 changes: 8 additions & 0 deletions recipes-tag/mpi4py/run_test.sh
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())'
50 changes: 50 additions & 0 deletions recipes-tag/mpich/build.sh
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
64 changes: 64 additions & 0 deletions recipes-tag/mpich/meta.yaml
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
Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

@mrakitin mrakitin Feb 4, 2019

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.

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
38 changes: 38 additions & 0 deletions recipes-tag/mpich/run_test.sh
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
19 changes: 19 additions & 0 deletions recipes-tag/mpich/tests/helloworld.c
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;
}
22 changes: 22 additions & 0 deletions recipes-tag/mpich/tests/helloworld.cxx
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;
}
21 changes: 21 additions & 0 deletions recipes-tag/mpich/tests/helloworld.f
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
23 changes: 23 additions & 0 deletions recipes-tag/mpich/tests/helloworld.f90
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
Loading