Skip to content

Commit cf22917

Browse files
Merge pull request #68 from Matthew-Whitlock/ci_update
Ci update, bugfixes
2 parents 0a5b8f6 + bdb409e commit cf22917

34 files changed

+451
-355
lines changed

.github/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#Built for testing, not designed for application use.
2+
3+
FROM ubuntu:20.04
4+
#="open-mpi/ompi" for github.com/open-mpi/ompi
5+
ARG OPENMPI_REPO="open-mpi/ompi"
6+
#="tags" or ="heads", for tag or branch name
7+
ARG OPENMPI_VERS_PREFIX="tags"
8+
#="v5.0.0rc10" or ="v5.0.x", ie tag name or branch name.
9+
ARG OPENMPI_VERS="v5.0.0rc10"
10+
run echo Using https://github.com/${OPENMPI_REPO}/git/refs/${OPENMPI_VERS_PREFIX}/${OPENMPI_VERS}
11+
12+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential python3 m4 autoconf automake libtool flex git zlib1g-dev
13+
14+
#Add files listing latest commit for this branch/tag, which invalidates the clone
15+
#when a change has been pushed.
16+
ADD https://api.github.com/repos/${OPENMPI_REPO}/git/refs/${OPENMPI_VERS_PREFIX}/${OPENMPI_VERS} commit_info
17+
RUN git clone --recursive --branch ${OPENMPI_VERS} --depth 1 https://github.com/${OPENMPI_REPO}.git ompi_src && \
18+
mkdir ompi_build ompi_install && cd ompi_src && export AUTOMAKE_JOBS=8 && ./autogen.pl && cd ../ompi_build && ../ompi_src/configure --prefix=/ompi_install --disable-man-pages --with-ft=ulfm && make install -j8 && cd ..
19+
20+
21+
#New build stage, tosses out src/build trees from openmpi
22+
FROM ubuntu:20.04
23+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake ssh zlib1g-dev
24+
COPY . ./fenix_src
25+
COPY --from=0 ompi_install/ /ompi_install/
26+
ENV PATH="$PATH:/ompi_install/bin"
27+
RUN mkdir fenix_build fenix_install && cd fenix_build && cmake ../fenix_src -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/ompi_install/bin/mpicc \
28+
-DFENIX_EXAMPLES=ON -DFENIX_TESTS=ON -DCMAKE_INSTALL_PREFIX=../fenix_install -DMPIEXEC_PREFLAGS="--allow-run-as-root;--map-by;:OVERSUBSCRIBE" && make install -j8
29+
CMD ["sh", "-c", "cd fenix_build && ctest --verbose --timeout 60"]

.github/docker-compose.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
version: "3.9"
2+
3+
x-fenix: &fenix
4+
build: &fenix-build
5+
context: ./
6+
dockerfile: .github/Dockerfile
7+
args:
8+
OPENMPI_REPO: open-mpi/ompi
9+
OPENMPI_VERS_PREFIX: tags
10+
OPENMPI_VERS: v5.0.0rc10
11+
#Caches should be manually scoped, or they'll conflict.
12+
x-bake:
13+
cache-from:
14+
- type=gha,scope=default
15+
cache-to:
16+
- type=gha,scope=default,mode=max
17+
18+
services:
19+
#fenix_ompi_5rc10:
20+
# <<: *fenix
21+
# image: "fenix:ompi_5rc10"
22+
# build:
23+
# <<: *fenix-build
24+
# x-bake:
25+
# cache-from:
26+
# - type=gha,scope=ompi_5rc10
27+
# cache-to:
28+
# - type=gha,scope=ompi_5rc10,mode=max
29+
30+
fenix_ompi_5:
31+
<<: *fenix
32+
image: "fenix:ompi_5"
33+
build:
34+
<<: *fenix-build
35+
args:
36+
- OPENMPI_VERS_PREFIX=heads
37+
- OPENMPI_VERS=v5.0.x
38+
x-bake:
39+
cache-from:
40+
- type=gha,scope=ompi_5
41+
cache-to:
42+
- type=gha,scope=ompi_5,mode=max
43+
44+
fenix_ompi_main:
45+
<<: *fenix
46+
image: "fenix:ompi_main"
47+
build:
48+
<<: *fenix-build
49+
args:
50+
- OPENMPI_VERS_PREFIX=heads
51+
- OPENMPI_VERS=main
52+
x-bake:
53+
cache-from:
54+
- type=gha,scope=ompi_main
55+
cache-to:
56+
- type=gha,scope=ompi_main,mode=max
57+
58+
fenix_icldisco_latest:
59+
<<: *fenix
60+
image: "fenix:icldisco_latest"
61+
build:
62+
<<: *fenix-build
63+
args:
64+
- OPENMPI_REPO=icldisco/ompi
65+
- OPENMPI_VERS_PREFIX=heads
66+
- OPENMPI_VERS=ulfm/latest
67+
x-bake:
68+
cache-from:
69+
- type=gha,scope=icldisco_latest
70+
cache-to:
71+
- type=gha,scope=icldisco_latest,mode=max
72+
73+
#fenix_icldisco_experimental:
74+
# <<: *fenix
75+
# image: fenix/icldisco
76+
# build:
77+
# <<: *fenix-build
78+
# args:
79+
# - OPENMPI_REPO=icldisco/ompi
80+
# - OPENMPI_VERS_PREFIX=heads
81+
# - OPENMPI_VERS=ulfm/experimental

.github/workflows/ci_checks.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build & Test
2+
3+
on:
4+
push:
5+
pull_request_target:
6+
types:
7+
- opened
8+
- synchronized
9+
- edited
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: docker/setup-buildx-action@v2
17+
- name: Build
18+
uses: docker/bake-action@master
19+
with:
20+
files: |
21+
.github/docker-compose.yml
22+
load: true
23+
- name: Test open-mpi v5.0.x
24+
if: success() || failure()
25+
run: docker run fenix:ompi_5
26+
- name: Test open-mpi main
27+
if: success() || failure()
28+
run: docker run fenix:ompi_main
29+
- name: Test icldisco latest
30+
if: success() || failure()
31+
run: docker run fenix:icldisco_latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ examples/05_subset_create/subset_create
3939
examples/06_subset_createv/subset_createv
4040
test/request_tracking/fenix_request_tracking_test
4141
test/request_tracking/fenix_request_tracking_test_nofenix
42+
build/
43+
install/
4244

4345
# Other
4446
*~

.travis.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 37 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -8,108 +8,66 @@
88
# directory.
99
#
1010

11-
cmake_minimum_required(VERSION 3.0.2)
11+
cmake_minimum_required(VERSION 3.10.2)
1212

1313
project(Fenix C)
1414
# The version number.
1515
set(FENIX_VERSION_MAJOR 1)
1616
set(FENIX_VERSION_MINOR 0)
1717

18-
option(BUILD_EXAMPLES "Builds example programs from the examples directory" OFF)
19-
option(BUILD_TESTING "Builds tests and test modes of files" ON)
18+
option(BUILD_EXAMPLES "Builds example programs from the examples directory" OFF)
19+
option(BUILD_TESTING "Builds tests and test modes of files" ON)
2020

2121

22-
# Set empty string for shared linking (we use static library only at this moment)
23-
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
22+
#Solves an issue with some system environments putting their MPI headers before
23+
#the headers CMake includes. Forces non-system MPI headers when incorrect headers
24+
#detected in include path.
25+
option(FENIX_SYSTEM_INC_FIX "Attempts to force overriding any system MPI headers" ON)
26+
option(FENIX_PROPAGATE_INC_FIX "Attempt overriding system MPI headers in linking projects" ON)
2427

25-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
26-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
28+
find_package(MPI REQUIRED)
2729

28-
#set(CMAKE_BUILD_TYPE Release)
29-
set(CMAKE_BUILD_TYPE Debug)
30-
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O0 -ggdb")
30+
if(${FENIX_SYSTEM_INC_FIX})
31+
include(cmake/systemMPIOverride.cmake)
32+
endif()
3133

32-
#ENABLE_TESTING
33-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
34-
#include(testref/TestAgainstReference)
3534

36-
configure_file(
37-
${CMAKE_CURRENT_SOURCE_DIR}/include/fenix-config.h.in
38-
${CMAKE_CURRENT_BINARY_DIR}/include/fenix-config.h @ONLY
39-
)
35+
add_subdirectory(src)
4036

4137

42-
#Check for MPICC definition, if not try to find MPI
43-
if(NOT "a$ENV{MPICC}" STREQUAL "a")
44-
#set(CMAKE_C_COMPILER ${MPI_C_COMPILER} CACHE STRING "The compiler CMake should use - often set to mpicc" FORCE)
45-
set(MPI_C_COMPILER $ENV{MPICC})
46-
set(CMAKE_C_COMPILER ${MPI_C_COMPILER})
47-
48-
message("[fenix] MPICC has been passed: $ENV{MPICC}")
49-
else()
50-
message("[fenix] MPICC was not passed, searching for MPI")
51-
find_package(MPI REQUIRED)
52-
if(${MPI_C_FOUND})
53-
message("[fenix] Found MPICC: ${MPI_C_COMPILER}")
54-
else()
55-
message( FATAL_ERROR "[fenix] MPI not found :( Aborting!")
56-
endif()
38+
include(CTest)
39+
list(APPEND MPIEXEC_PREFLAGS "--with-ft;mpi")
40+
41+
if(BUILD_EXAMPLES)
42+
add_subdirectory(examples)
5743
endif()
5844

59-
#Helper function for linking with MPI only if needed
60-
function(linkMPI TOLINK)
61-
#We only want to try to find MPI outrselves if it wasn't provided in MPICC by user
62-
if("a$ENV{MPICC}" STREQUAL "a")
63-
#find_package(MPI REQUIRED)
64-
target_link_libraries(${TOLINK} MPI::MPI_C)
65-
endif()
66-
endfunction(linkMPI)
45+
if(BUILD_TESTING)
46+
add_subdirectory(test)
47+
endif()
48+
49+
50+
51+
configure_file(
52+
${CMAKE_CURRENT_SOURCE_DIR}/include/fenix-config.h.in
53+
${CMAKE_CURRENT_BINARY_DIR}/include/fenix-config.h @ONLY
54+
)
55+
configure_file(
56+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/systemMPIOverride.cmake
57+
${CMAKE_CURRENT_BINARY_DIR}/cmake/systemMPIOverride.cmake COPYONLY
58+
)
6759

68-
add_subdirectory(src)
6960

7061
include(CMakePackageConfigHelpers)
71-
configure_package_config_file(fenixConfig.cmake.in
72-
${CMAKE_CURRENT_BINARY_DIR}/fenixConfig.cmake
62+
configure_package_config_file(cmake/fenixConfig.cmake.in
63+
${CMAKE_CURRENT_BINARY_DIR}/cmake/fenixConfig.cmake
7364
INSTALL_DESTINATION cmake)
74-
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/fenixConfigVersion.cmake
65+
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/cmake/fenixConfigVersion.cmake
7566
VERSION "${FENIX_VERSION_MAJOR}.${FENIX_VERSION_MINOR}"
7667
COMPATIBILITY SameMajorVersion)
7768
install(
7869
FILES
79-
${CMAKE_CURRENT_BINARY_DIR}/fenixConfig.cmake
80-
${CMAKE_CURRENT_BINARY_DIR}/fenixConfigVersion.cmake
70+
${CMAKE_CURRENT_BINARY_DIR}/cmake/fenixConfig.cmake
71+
${CMAKE_CURRENT_BINARY_DIR}/cmake/systemMPIOverride.cmake
8172
DESTINATION cmake
8273
)
83-
84-
85-
include(CTest)
86-
87-
if(BUILD_EXAMPLES)
88-
add_subdirectory(examples/01_hello_world/fenix)
89-
add_subdirectory(examples/01_hello_world/mpi)
90-
add_subdirectory(examples/02_send_recv/fenix)
91-
add_subdirectory(examples/02_send_recv/mpi)
92-
add_subdirectory(examples/03_reduce/fenix)
93-
#add_subdirectory(examples/03_reduce/mpi)
94-
add_subdirectory(examples/04_Isend_Irecv/fenix)
95-
add_subdirectory(examples/04_Isend_Irecv/mpi)
96-
add_subdirectory(examples/05_subset_create)
97-
add_subdirectory(examples/06_subset_createv)
98-
99-
elseif(BUILD_TESTING)
100-
#Some examples are useful tests as well.
101-
add_subdirectory(examples/01_hello_world/fenix)
102-
add_subdirectory(examples/02_send_recv/fenix)
103-
add_subdirectory(examples/03_reduce/fenix)
104-
add_subdirectory(examples/05_subset_create)
105-
add_subdirectory(examples/06_subset_createv)
106-
endif()
107-
108-
if(BUILD_TESTING)
109-
add_subdirectory(test/subset_internal)
110-
add_subdirectory(test/subset_merging)
111-
add_subdirectory(test/request_tracking)
112-
add_subdirectory(test/request_cancelled)
113-
add_subdirectory(test/no_jump)
114-
add_subdirectory(test/issend)
115-
endif()

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717
These instructions assume you are in your home directory.
1818

1919
1. Checkout Fenix sources
20-
* For example: ` git clone <address of this repo> `
20+
* For example: ` git clone <address of this repo> && cd Fenix`
2121
2. Create a build directory.
22-
* For example: ` mkdir -p ~/build/fenix/ && cd ~/build/fenix/ `
2322
3. Specify the MPI C compiler to use. [Open MPI 5+](https://github.com/open-mpi/ompi/tree/v5.0.x) is the required version.
24-
* To manually indicate which compiler `cmake` should use, set the `MPICC` variable to point to it.
25-
* For example: ` export MPICC=~/install/mpi-ulfm/bin/mpicc `
26-
* If the `MPICC` environment variable is not there, `cmake` will try to guess where the MPI implementation is. To help, make sure you include the installation directory of MPI in your `PATH`.
27-
* For example: ` export PATH=~/install/mpi-ulfm/bin:$PATH `
28-
4. Run ` cmake <Fenix source directory> ` and ` make `
29-
* For example: ` cmake ~/Fenix && make `
30-
5. For best compatibility with other cmake projects, run ` make install ` and add the install directory to your CMAKE\_PREFIX\_PATH
23+
* Check out the CMake documentation for the best information on how to do this, but in general:
24+
* Set the CC environment variable to the correct `mpicc`,
25+
* Invoke cmake with `-DCMAKE_C_COMPILER=mpicc`,
26+
* Add the mpi install directory to CMAKE_PREFIX_PATH.
27+
* If you experience segmentation faults during simple MPI function calls, this is often caused by accidentally building against multiple versions of MPI. See the FENIX_SYSTEM_INC_FIX CMake option for a potential fix.
28+
4. Run ` cmake ../ -DCMAKE_INSTALL_PREFIX=... && make install`
29+
5. Optionally, add the install prefix to your CMAKE\_PREFIX\_PATHS environment variable, to enable `find_package(fenix)` in your other projects.
3130

3231

3332
<pre>

0 commit comments

Comments
 (0)