Skip to content

Commit

Permalink
Merge pull request #68 from Matthew-Whitlock/ci_update
Browse files Browse the repository at this point in the history
Ci update, bugfixes
  • Loading branch information
Matthew-Whitlock committed Feb 12, 2024
2 parents 0a5b8f6 + bdb409e commit cf22917
Show file tree
Hide file tree
Showing 34 changed files with 451 additions and 355 deletions.
29 changes: 29 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Built for testing, not designed for application use.

FROM ubuntu:20.04
#="open-mpi/ompi" for github.com/open-mpi/ompi
ARG OPENMPI_REPO="open-mpi/ompi"
#="tags" or ="heads", for tag or branch name
ARG OPENMPI_VERS_PREFIX="tags"
#="v5.0.0rc10" or ="v5.0.x", ie tag name or branch name.
ARG OPENMPI_VERS="v5.0.0rc10"
run echo Using https://github.com/${OPENMPI_REPO}/git/refs/${OPENMPI_VERS_PREFIX}/${OPENMPI_VERS}

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential python3 m4 autoconf automake libtool flex git zlib1g-dev

#Add files listing latest commit for this branch/tag, which invalidates the clone
#when a change has been pushed.
ADD https://api.github.com/repos/${OPENMPI_REPO}/git/refs/${OPENMPI_VERS_PREFIX}/${OPENMPI_VERS} commit_info
RUN git clone --recursive --branch ${OPENMPI_VERS} --depth 1 https://github.com/${OPENMPI_REPO}.git ompi_src && \
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 ..


#New build stage, tosses out src/build trees from openmpi
FROM ubuntu:20.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake ssh zlib1g-dev
COPY . ./fenix_src
COPY --from=0 ompi_install/ /ompi_install/
ENV PATH="$PATH:/ompi_install/bin"
RUN mkdir fenix_build fenix_install && cd fenix_build && cmake ../fenix_src -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/ompi_install/bin/mpicc \
-DFENIX_EXAMPLES=ON -DFENIX_TESTS=ON -DCMAKE_INSTALL_PREFIX=../fenix_install -DMPIEXEC_PREFLAGS="--allow-run-as-root;--map-by;:OVERSUBSCRIBE" && make install -j8
CMD ["sh", "-c", "cd fenix_build && ctest --verbose --timeout 60"]
81 changes: 81 additions & 0 deletions .github/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: "3.9"

x-fenix: &fenix
build: &fenix-build
context: ./
dockerfile: .github/Dockerfile
args:
OPENMPI_REPO: open-mpi/ompi
OPENMPI_VERS_PREFIX: tags
OPENMPI_VERS: v5.0.0rc10
#Caches should be manually scoped, or they'll conflict.
x-bake:
cache-from:
- type=gha,scope=default
cache-to:
- type=gha,scope=default,mode=max

services:
#fenix_ompi_5rc10:
# <<: *fenix
# image: "fenix:ompi_5rc10"
# build:
# <<: *fenix-build
# x-bake:
# cache-from:
# - type=gha,scope=ompi_5rc10
# cache-to:
# - type=gha,scope=ompi_5rc10,mode=max

fenix_ompi_5:
<<: *fenix
image: "fenix:ompi_5"
build:
<<: *fenix-build
args:
- OPENMPI_VERS_PREFIX=heads
- OPENMPI_VERS=v5.0.x
x-bake:
cache-from:
- type=gha,scope=ompi_5
cache-to:
- type=gha,scope=ompi_5,mode=max

fenix_ompi_main:
<<: *fenix
image: "fenix:ompi_main"
build:
<<: *fenix-build
args:
- OPENMPI_VERS_PREFIX=heads
- OPENMPI_VERS=main
x-bake:
cache-from:
- type=gha,scope=ompi_main
cache-to:
- type=gha,scope=ompi_main,mode=max

fenix_icldisco_latest:
<<: *fenix
image: "fenix:icldisco_latest"
build:
<<: *fenix-build
args:
- OPENMPI_REPO=icldisco/ompi
- OPENMPI_VERS_PREFIX=heads
- OPENMPI_VERS=ulfm/latest
x-bake:
cache-from:
- type=gha,scope=icldisco_latest
cache-to:
- type=gha,scope=icldisco_latest,mode=max

#fenix_icldisco_experimental:
# <<: *fenix
# image: fenix/icldisco
# build:
# <<: *fenix-build
# args:
# - OPENMPI_REPO=icldisco/ompi
# - OPENMPI_VERS_PREFIX=heads
# - OPENMPI_VERS=ulfm/experimental
31 changes: 31 additions & 0 deletions .github/workflows/ci_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build & Test

on:
push:
pull_request_target:
types:
- opened
- synchronized
- edited

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- name: Build
uses: docker/bake-action@master
with:
files: |
.github/docker-compose.yml
load: true
- name: Test open-mpi v5.0.x
if: success() || failure()
run: docker run fenix:ompi_5
- name: Test open-mpi main
if: success() || failure()
run: docker run fenix:ompi_main
- name: Test icldisco latest
if: success() || failure()
run: docker run fenix:icldisco_latest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ examples/05_subset_create/subset_create
examples/06_subset_createv/subset_createv
test/request_tracking/fenix_request_tracking_test
test/request_tracking/fenix_request_tracking_test_nofenix
build/
install/

# Other
*~
Expand Down
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

116 changes: 37 additions & 79 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,108 +8,66 @@
# directory.
#

cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.10.2)

project(Fenix C)
# The version number.
set(FENIX_VERSION_MAJOR 1)
set(FENIX_VERSION_MINOR 0)

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


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

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
find_package(MPI REQUIRED)

#set(CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE Debug)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O0 -ggdb")
if(${FENIX_SYSTEM_INC_FIX})
include(cmake/systemMPIOverride.cmake)
endif()

#ENABLE_TESTING
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
#include(testref/TestAgainstReference)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/fenix-config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/fenix-config.h @ONLY
)
add_subdirectory(src)


#Check for MPICC definition, if not try to find MPI
if(NOT "a$ENV{MPICC}" STREQUAL "a")
#set(CMAKE_C_COMPILER ${MPI_C_COMPILER} CACHE STRING "The compiler CMake should use - often set to mpicc" FORCE)
set(MPI_C_COMPILER $ENV{MPICC})
set(CMAKE_C_COMPILER ${MPI_C_COMPILER})

message("[fenix] MPICC has been passed: $ENV{MPICC}")
else()
message("[fenix] MPICC was not passed, searching for MPI")
find_package(MPI REQUIRED)
if(${MPI_C_FOUND})
message("[fenix] Found MPICC: ${MPI_C_COMPILER}")
else()
message( FATAL_ERROR "[fenix] MPI not found :( Aborting!")
endif()
include(CTest)
list(APPEND MPIEXEC_PREFLAGS "--with-ft;mpi")

if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

#Helper function for linking with MPI only if needed
function(linkMPI TOLINK)
#We only want to try to find MPI outrselves if it wasn't provided in MPICC by user
if("a$ENV{MPICC}" STREQUAL "a")
#find_package(MPI REQUIRED)
target_link_libraries(${TOLINK} MPI::MPI_C)
endif()
endfunction(linkMPI)
if(BUILD_TESTING)
add_subdirectory(test)
endif()



configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/fenix-config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/fenix-config.h @ONLY
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/systemMPIOverride.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/systemMPIOverride.cmake COPYONLY
)

add_subdirectory(src)

include(CMakePackageConfigHelpers)
configure_package_config_file(fenixConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/fenixConfig.cmake
configure_package_config_file(cmake/fenixConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/fenixConfig.cmake
INSTALL_DESTINATION cmake)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/fenixConfigVersion.cmake
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/cmake/fenixConfigVersion.cmake
VERSION "${FENIX_VERSION_MAJOR}.${FENIX_VERSION_MINOR}"
COMPATIBILITY SameMajorVersion)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/fenixConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/fenixConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/fenixConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/systemMPIOverride.cmake
DESTINATION cmake
)


include(CTest)

if(BUILD_EXAMPLES)
add_subdirectory(examples/01_hello_world/fenix)
add_subdirectory(examples/01_hello_world/mpi)
add_subdirectory(examples/02_send_recv/fenix)
add_subdirectory(examples/02_send_recv/mpi)
add_subdirectory(examples/03_reduce/fenix)
#add_subdirectory(examples/03_reduce/mpi)
add_subdirectory(examples/04_Isend_Irecv/fenix)
add_subdirectory(examples/04_Isend_Irecv/mpi)
add_subdirectory(examples/05_subset_create)
add_subdirectory(examples/06_subset_createv)

elseif(BUILD_TESTING)
#Some examples are useful tests as well.
add_subdirectory(examples/01_hello_world/fenix)
add_subdirectory(examples/02_send_recv/fenix)
add_subdirectory(examples/03_reduce/fenix)
add_subdirectory(examples/05_subset_create)
add_subdirectory(examples/06_subset_createv)
endif()

if(BUILD_TESTING)
add_subdirectory(test/subset_internal)
add_subdirectory(test/subset_merging)
add_subdirectory(test/request_tracking)
add_subdirectory(test/request_cancelled)
add_subdirectory(test/no_jump)
add_subdirectory(test/issend)
endif()
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
These instructions assume you are in your home directory.

1. Checkout Fenix sources
* For example: ` git clone <address of this repo> `
* For example: ` git clone <address of this repo> && cd Fenix`
2. Create a build directory.
* For example: ` mkdir -p ~/build/fenix/ && cd ~/build/fenix/ `
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.
* To manually indicate which compiler `cmake` should use, set the `MPICC` variable to point to it.
* For example: ` export MPICC=~/install/mpi-ulfm/bin/mpicc `
* 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`.
* For example: ` export PATH=~/install/mpi-ulfm/bin:$PATH `
4. Run ` cmake <Fenix source directory> ` and ` make `
* For example: ` cmake ~/Fenix && make `
5. For best compatibility with other cmake projects, run ` make install ` and add the install directory to your CMAKE\_PREFIX\_PATH
* Check out the CMake documentation for the best information on how to do this, but in general:
* Set the CC environment variable to the correct `mpicc`,
* Invoke cmake with `-DCMAKE_C_COMPILER=mpicc`,
* Add the mpi install directory to CMAKE_PREFIX_PATH.
* 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.
4. Run ` cmake ../ -DCMAKE_INSTALL_PREFIX=... && make install`
5. Optionally, add the install prefix to your CMAKE\_PREFIX\_PATHS environment variable, to enable `find_package(fenix)` in your other projects.


<pre>
Expand Down
Loading

0 comments on commit cf22917

Please sign in to comment.