Skip to content

Commit 63eb380

Browse files
committed
Merge branch 'master' into vehre/issue-292-type-conversion-during-communication
2 parents f5e6a82 + 1be1382 commit 63eb380

28 files changed

+620
-63
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.log
2+
log.*
3+
.git
4+
.gitignore
5+
hooks
6+
*~
7+
Untitled*.ipynb
8+
Makefile
9+
#*#
10+
\#*\#
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
FROM jupyter/minimal-notebook:da2c5a4d00fa
2+
3+
MAINTAINER Izaak Beekman <[email protected]>
4+
5+
USER root
6+
ENV GCC_VERSION 7.2.0
7+
8+
ENV NB_USER jovyan
9+
ENV NB_UID 1000
10+
ENV HOME /home/${NB_USER}
11+
12+
RUN DEBIAN_FRONTEND=noninteractive transientBuildDeps="file" \
13+
&& set -v \
14+
&& cat /etc/issue \
15+
&& uname -a \
16+
&& echo "${DEBIAN_FRONTEND}" \
17+
&& apt-get update -y \
18+
&& apt-get install -y \
19+
software-properties-common \
20+
&& add-apt-repository ppa:ubuntu-toolchain-r/test -y \
21+
&& apt-get update -y \
22+
&& apt-get install -y \
23+
build-essential \
24+
gcc-7=${GCC_VERSION}-1ubuntu1~16.04 \
25+
gfortran-7=${GCC_VERSION}-1ubuntu1~16.04 \
26+
g++-7=${GCC_VERSION}-1ubuntu1~16.04 \
27+
mpich \
28+
${transientBuildDeps} \
29+
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-7 \
30+
&& update-alternatives --set gcc "/usr/bin/gcc-7" \
31+
&& gcc --version \
32+
&& gfortran --version \
33+
&& mpiexec --version \
34+
&& mpifort --version \
35+
&& mpicc --version \
36+
&& apt-get clean \
37+
&& apt-get purge -y --auto-remove ${transientBuildDeps} \
38+
&& rm -rf /var/lib/apt/lists/* /var/log/* /tmp/*
39+
40+
# Build-time metadata as defined at http://label-schema.org
41+
ARG BUILD_DATE
42+
ARG VCS_REF
43+
ARG VCS_URL
44+
ARG VCS_VERSION=latest
45+
LABEL org.label-schema.schema-version="1.0" \
46+
org.label-schema.build-date="${BUILD_DATE}" \
47+
org.label-schema.name="" \
48+
org.label-schema.description="Coarray Fortran compiler with GFortran ${GCC_VERSION}, OpenCoarrays and MPICH backend" \
49+
org.label-schema.url="https://github.com/sourceryinstitute/OpenCoarrays#readme/" \
50+
org.label-schema.vcs-ref="${VCS_REF}" \
51+
org.label-schema.vcs-url="${VCS_URL}" \
52+
org.label-schema.version="${VCS_VERSION}" \
53+
org.label-schema.vendor="SourceryInstitute" \
54+
org.label-schema.license="BSD" \
55+
org.label-schema.docker.cmd="docker run -i -t -p 8888:8888 sourceryinstitute/opencoarrays-notebook"
56+
57+
ARG RUN_TESTS=false
58+
59+
RUN DEBIAN_FRONTEND=noninteractive transientBuildDeps="cmake git" \
60+
&& set -v \
61+
&& echo "${DEBIAN_FRONTEND}" \
62+
&& apt-get update && apt-get install -y \
63+
${transientBuildDeps} \
64+
&& cmake --version \
65+
&& gcc --version \
66+
&& gfortran --version \
67+
&& git clone --single-branch https://github.com/sourceryinstitute/OpenCoarrays \
68+
&& mkdir OpenCoarrays/build \
69+
&& cd OpenCoarrays/build \
70+
&& FC="$(which gfortran)" CC="$(which gcc)" cmake -DCMAKE_BUILD_TYPE=Release .. \
71+
&& make -j "$(nproc)" install \
72+
&& if [ "${RUN_TESTS}" = "true" ] ; then ctest --output-on-failure ; fi \
73+
&& cd ../.. \
74+
&& caf --version \
75+
&& cafrun --version \
76+
&& rm -rf OpenCoarrays \
77+
&& apt-get clean \
78+
&& apt-get purge -y --auto-remove ${transientBuildDeps} \
79+
&& rm -rf /var/lib/apt/lists/* /var/log/* /tmp/*
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
SHELL := /usr/local/bin/bash -o pipefail
2+
NAME = sourceryinstitute/opencoarrays-notebook
3+
#UBADGER_ENDPOINT = "https://hooks.microbadger.com/images/sourceryinstitute/jupyter-caf-kernel/CEL6DIVw-OVbUIXieZhZwvDXl3I="
4+
GIT_MASTER_HEAD_SHA:=$(shell git rev-parse --short=12 --verify HEAD)
5+
6+
.PHONY: help build push run runclean clean
7+
.DEFAULT_GOAL := help
8+
9+
# Add the following 'help' target to your Makefile
10+
# And add help text after each target name starting with '\#\#'
11+
12+
help: ## This help message
13+
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
14+
15+
build: $(subst /,_,$(NAME))-build.stamp ## Build docker file. Depending on which packages are rebuilt this may take a long time
16+
17+
$(subst /,_,$(NAME))-build.stamp: Dockerfile .dockerignore hooks/build ## Target for doing & timestamping the build
18+
touch $@
19+
hooks/build 2>&1 | tee $(subst stamp,log,$@) || rm -rf $@
20+
docker tag $(NAME):latest $(NAME):$(GIT_MASTER_HEAD_SHA)
21+
22+
push: $(subst /,_,$(NAME))-push.stamp ## Push prebuild docker image up to hub.docker.com
23+
24+
$(subst /,_,$(NAME))-push.stamp: $(subst /,_,$(NAME))-build.stamp Dockerfile .dockerignore hooks/build ## Target for doing & timestamping the push
25+
touch $@
26+
docker push $(NAME):latest | tee $(subst stamp,log,$@) || rm -rf $@
27+
docker push $(NAME):$(GIT_MASTER_HEAD_SHA) | tee -a $(subst stamp,log,$@) || rm -rf $@
28+
-curl -X POST "$(UBADGER_ENDPOINT)"
29+
30+
run: ## Target to run jupyter-hub docker server
31+
docker run -i -t -p 8888:8888 $(NAME) | tee $(subst /,_,$(NAME))-run.log
32+
33+
runclean: ## Target to run jupyter-hub docker server, discarding changes
34+
docker run --rm -i -t -p 8888:8888 $(NAME) | tee $(subst /,_,$(NAME))-runclean.log
35+
36+
clean:
37+
-rm -rf $(subst /,_,$(NAME))*.stamp
38+
-find . -name 'Untitled*.ipynd' -exec rm -f {} \;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
# See https://github.com/rossf7/label-schema-automated-build
3+
# or https://medium.com/microscaling-systems/labelling-automated-builds-on-docker-hub-f3d073fb8e1#.wgkzfdnfr
4+
# for more details.
5+
6+
# $IMAGE_NAME var is injected into the build so the tag is correct.
7+
8+
set -o verbose
9+
set -o pipefail
10+
set -o errexit
11+
set -x
12+
13+
git fetch -v --all --tags
14+
git fetch -v --all --depth=9999999 --update-shallow
15+
git tag --list
16+
git branch
17+
18+
d_repo='sourceryinstitute/OpenCoarrays'
19+
d_git_remotes=($(git remote show))
20+
echo "${#d_git_remotes[@]} git remotes found."
21+
n_remotes=${#d_git_remotes[@]}
22+
if (( n_remotes > 0 )) ; then
23+
echo "Using remote: ${d_git_remotes[0]}"
24+
d_vcs_url="$(git remote -v | awk 'FNR == 1 {print $2}')"
25+
fi
26+
27+
if [[ -z "${d_vcs_url:-}" ]]; then
28+
d_vcs_url="https://github.com/${DOCKER_REPO:-${d_repo}}"
29+
fi
30+
31+
branch_name="$(git symbolic-ref -q HEAD)" || true
32+
branch_name="${branch_name##refs/heads/}"
33+
branch_name="${branch_name:-DETACHED-HEAD}"
34+
35+
d_vcs_describe="$(git describe --tags --always || true)"
36+
d_tag="${IMAGE_NAME##*:}"
37+
d_tag="${d_tag:-${branch_name}-$(date +%s)}"
38+
d_vcs_tag="$(git rev-parse --short=12 --verify HEAD)"
39+
40+
if [[ ${IMAGE_NAME:-} ]]; then
41+
export RUN_TESTS=false
42+
else
43+
export RUN_TESTS=${RUN_TESTS:-false}
44+
fi
45+
46+
47+
opencoarrays_version="${d_vcs_describe}"
48+
if [[ -n "${open_coarrays_version:-}" ]]; then
49+
opencoarrays_version=1.9.2
50+
fi
51+
52+
echo "Build hook running"
53+
docker build --build-arg OPENCOARRAYS_VERSION="${opencoarrays_version}" \
54+
--build-arg RUN_TESTS=${RUN_TESTS} \
55+
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
56+
--build-arg VCS_REF="${SOURCE_COMMIT:-$(git rev-parse --short HEAD)}" \
57+
--build-arg VCS_URL="${d_vcs_url}" \
58+
--build-arg VCS_VERSION="${d_vcs_describe:-${d_tag}}" \
59+
--rm \
60+
--pull \
61+
-t "${IMAGE_NAME:-$(tr '[:upper:]' '[:lower:]' <<< "${d_repo}:latest")}" .
62+
docker tag "${IMAGE_NAME:-$(tr '[:upper:]' '[:lower:]' <<< "${d_repo}:latest")}" "${IMAGE_NAME:-$(tr '[:upper:]' '[:lower:]' <<< "${d_repo}:${d_vcs_tag}")}"

.VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$Format:%d%n%n$
22
# Fall back version, probably last release:
3-
1.9.1
3+
1.9.3
44

55
# OpenCoarrays version file. This project uses semantic
66
# versioning. For details see http://semver.org

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ codecov.yml export-ignore
3535
makefile export-ignore
3636
Makefile export-ignore
3737
make.inc* export-ignore
38+
.Dockerfiles export-ignore
3839

3940
# Experimental conduits/backends
4041
src/gasnet export-ignore

.travis.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ env:
1414
- MPICH_GCC7_BOT_URL_HEAD="https://github.com/sourceryinstitute/OpenCoarrays/files/976779/"
1515
- MPICH_BOT_URL_TAIL="mpich-3.2_3.yosemite.bottle.1.tar.gz"
1616
- BUILD_TYPES="Release Debug RelWithDebInfo CodeCoverage"
17-
matrix:
18-
- GCC=6 OSX_PACKAGES="gcc@6 cmake shellcheck"
19-
- GCC=7 OSX_PACKAGES="gcc cmake shellcheck"
17+
matrix: # shellcheck installed manually below for macOS
18+
- GCC=6 OSX_PACKAGES="gcc@6 cmake"
19+
- GCC=7 OSX_PACKAGES="gcc cmake"
2020

2121
matrix:
2222
fast_finish: true
@@ -137,9 +137,11 @@ install:
137137
if [[ (-n ${TRAVIS}) && (${TRAVIS_OS_NAME} == osx) ]]; then
138138
brew update > /dev/null
139139
140+
[[ "$(brew ls --versions shellcheck)" ]] || brew install --force-bottle shellcheck
141+
brew outdated shellcheck || brew upgrade --force-bottle shellcheck
140142
for pkg in ${OSX_PACKAGES}; do
141-
[[ "$(brew ls --versions ${pkg})" ]] || brew install --force-bottle ${pkg}
142-
brew outdated ${pkg} || brew upgrade --force-bottle ${pkg}
143+
[[ "$(brew ls --versions ${pkg})" ]] || brew install ${pkg}
144+
brew outdated ${pkg} || brew upgrade ${pkg}
143145
done
144146
if [[ ${BUILD_TYPE} == InstallScript ]]; then # uninstall some stuff if present
145147
brew uninstall --force --ignore-dependencies cmake || true

CMakeLists.txt

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ if((NOT (OpenCoarraysVersion MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")) AND (EXISTS "$
4747
if(NOT (git_status STREQUAL "0"))
4848
set(full_git_describe NOTFOUND)
4949
endif()
50+
# Create a source distribution target using git archive
51+
# e.g., `make dist` will package a release using current git state
52+
add_custom_target(dist # OUTPUT "${CMAKE_BINARY_DIR}/${_OC_stem_name}.tar.gz"
53+
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/makeDist.cmake" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}"
54+
COMMENT "Creating source release asset, ${_OC_stem_name}.tar.gz, from ${git_full_describe} using the `git archive` command."
55+
VERBATIM)
5056
else()
5157
message( WARNING "Could not find git executable!")
5258
endif()
@@ -165,6 +171,9 @@ endif()
165171
if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 ) )
166172
add_definitions(-DGCC_GE_7) # Tell library to build against GFortran 7.x bindings b/c we might be using clang for C
167173
endif()
174+
if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0.0 ) )
175+
add_definitions(-DGCC_GE_8) # Tell library to build against GFortran 8.x bindings w/ descriptor change
176+
endif()
168177

169178
if(gfortran_compiler)
170179
set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
@@ -213,7 +222,7 @@ if ( (NOT MPI_C_FOUND) OR (NOT MPI_Fortran_FOUND) OR (NOT MPIEXEC))
213222
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
214223
OUTPUT_VARIABLE DEFAULT_MPICH_INSTALL_LOC
215224
OUTPUT_QUIET
216-
OUTPUT_STRIP_TRAILING_WHITES_SPACE
225+
OUTPUT_STRIP_TRAILING_WHITESPACE
217226
)
218227
find_program (MY_MPI_EXEC NAMES mpirun mpiexec lamexec srun
219228
PATHS "${DEFAULT_MPICH_INSTALL_LOC}" ENV PATH
@@ -429,6 +438,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/
429438
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
430439
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
431440

441+
#-----------------
442+
# Install manpages
443+
#-----------------
444+
install(FILES "${CMAKE_SOURCE_DIR}/doc/man/man1/caf.1" "${CMAKE_SOURCE_DIR}/doc/man/man1/cafrun.1"
445+
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
446+
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
447+
COMPONENT documentation)
448+
432449
#---------------------------------------------------
433450
# Define macro for compiling with caf wrapper script
434451
#---------------------------------------------------
@@ -481,11 +498,30 @@ endfunction()
481498
# Setup script style testing & enforcement macro
482499
#-----------------------------------------------
483500

501+
find_program(style_pl style.pl "${CMAKE_SOURCE_DIR}/developer-scripts/")
484502
function(check_script_style script_full_path)
485-
add_test(NAME "style:${script_full_path}"
486-
COMMAND "${CMAKE_SOURCE_DIR}/developer-scripts/style.pl" "${script_full_path}")
503+
if(style_pl)
504+
add_test(NAME "style:${script_full_path}"
505+
COMMAND "${style_pl}" "${script_full_path}")
506+
endif()
487507
endfunction()
488508

509+
#------------------------------------------------------------------------------
510+
# Add custom properties on targets for controling number of images during tests
511+
#------------------------------------------------------------------------------
512+
define_property(TARGET
513+
PROPERTY MIN_IMAGES
514+
BRIEF_DOCS "Minimum allowable images for the test <integer>"
515+
FULL_DOCS "Property to mark executable targets run as tests that they require at least <MIN_IMAGES> images to run"
516+
)
517+
518+
define_property(TARGET
519+
PROPERTY POWER_2_IMGS
520+
BRIEF_DOCS "True if test must be run with a power of 2 images (T/F)"
521+
FULL_DOCS "Property to mark executable targets run as tests that they require 2^n images."
522+
)
523+
524+
489525
#-------------------------------
490526
# Recurse into the src directory
491527
#-------------------------------
@@ -552,20 +588,32 @@ endif ()
552588
include( ProcessorCount )
553589
ProcessorCount(N_CPU)
554590
function(add_caf_test name num_caf_img test_target)
555-
# Function to add MPI tests.
556-
if ( ((N_CPU LESS num_caf_img) OR (N_CPU EQUAL 0)) )
557-
message(STATUS "Test ${name} is oversubscribed: ${num_caf_img} CAF images requested with ${N_CPU} system processor available.")
558-
if ( openmpi )
559-
if ( N_CPU LESS 2 )
560-
set( num_caf_img 2 )
561-
endif()
562-
set (test_parameters --oversubscribe)
563-
message( STATUS "Open-MPI back end detected, passing --oversubscribe for oversubscribed test, ${name}, with ${num_caf_img} ranks/images." )
564-
endif()
565-
endif()
566-
set(test_parameters -np ${num_caf_img} ${test_parameters})
567-
add_test(NAME ${name} COMMAND "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun" ${test_parameters} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test_target}")
568-
set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
591+
# Function to add MPI tests.
592+
if(TARGET ${test_target})
593+
get_target_property(min_test_imgs ${test_target} MIN_IMAGES)
594+
elseif(TARGET build_${test_target})
595+
get_target_property(min_test_imgs build_${test_target} MIN_IMAGES)
596+
endif()
597+
if(min_test_imgs)
598+
if(num_caf_img LESS min_test_imgs)
599+
message( FATAL_ERROR "Test ${name} requires ${min_test_imgs} but was only given ${num_caf_images}" )
600+
endif()
601+
endif()
602+
if ( ((N_CPU LESS num_caf_img) OR (N_CPU EQUAL 0)) )
603+
message(STATUS "Test ${name} is oversubscribed: ${num_caf_img} CAF images requested with ${N_CPU} system processor available.")
604+
if ( openmpi )
605+
if (min_test_imgs)
606+
set( num_caf_img ${min_test_imgs} )
607+
elseif ( N_CPU LESS 2 )
608+
set( num_caf_img 2 )
609+
endif()
610+
set (test_parameters --oversubscribe)
611+
message( STATUS "Open-MPI back end detected, passing --oversubscribe for oversubscribed test, ${name}, with ${num_caf_img} ranks/images." )
612+
endif()
613+
endif()
614+
set(test_parameters -np ${num_caf_img} ${test_parameters})
615+
add_test(NAME ${name} COMMAND "bash" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun" ${test_parameters} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test_target}")
616+
set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
569617
endfunction(add_caf_test)
570618

571619
#--------------

0 commit comments

Comments
 (0)