Skip to content

Commit

Permalink
Build System Improvements (#132)
Browse files Browse the repository at this point in the history
Ubuntu 18.04 bionic is now available on Travis-CI. This allows us to simplify the CI system significantly, since important dependencies like Swig and MPI are now up to date in apt's repository's.

While make these changes, a linking bug emerged that happens if you try to build on Linux without a toolchain file. This update also fixes this issue.
  • Loading branch information
william-dawson authored Nov 14, 2019
1 parent 04ee94f commit 3dd005b
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 54 deletions.
20 changes: 7 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
os: linux
sudo: required
dist: xenial
dist: bionic

notifications:
email: false
Expand All @@ -11,34 +11,28 @@ matrix:
include:
- os: linux
sudo: required
dist: trusty
dist: bionic
env: TESTOS="LINUX" TESTEXAMPLES=1 MAKETEST="make test"
- os: linux
sudo: required
dist: trusty
dist: bionic
env: TESTOS="LINUX" TESTEXAMPLES=1 DEBUG=1 MAKETEST="ctest -R Regression111""
- os: linux
sudo: required
dist: trusty
dist: bionic
env: TESTOS="LINUX" TESTEXAMPLES=1 NOIALLGATHER=1 MAKETEST="make test"
- os: linux
sudo: required
dist: trusty
env: TESTOS="LINUX" TESTEXAMPLES=1 MPICH=1 MAKETEST="ctest -R Regression211"
dist: bionic
env: TESTOS="LINUX" MPICH=1 MAKETEST="ctest -R Regression211"
- os: linux
sudo: required
dist: trusty
dist: bionic
env: TESTOS="LINUX" SKIPSWIG=1 MAKETEST=":"
- os: osx
sudo: required
env: TESTOS="OSX" MAKETEST="ctest -R Regression111"

cache:
pip: true
directories:
- openmpi-3.0.1
- swig-3.0.12

before_install:
- travis_wait bash UnitTests/travis_before_install.sh

Expand Down
5 changes: 3 additions & 2 deletions Examples/ComplexMatrix/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ mpicxx main.cc -c \
mpif90 main.o -o example \
-L../../Build/lib -lNTPolyCPP -lNTPolyWrapper -lNTPoly -fopenmp -lstdc++ \
-lblas
-lblas -lmpi_cxx
```

(for the intel compiler, build an intermediate main.o object using the
C++ compiler, and link with the fortran compiler using the flags:
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++).
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++ .
-lmpicxx is only necessary for openmpi, with mpich it should be omitted.).

## Program Usage

Expand Down
5 changes: 3 additions & 2 deletions Examples/GraphTheory/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ mpicxx main.cc -c \
mpif90 main.o -o example \
-L../../Build/lib -lNTPolyCPP -lNTPolyWrapper -lNTPoly -fopenmp -lstdc++ \
-lblas
-lblas -lmpi_cxx
```

(for the intel compiler, build an intermediate main.o object using the
C++ compiler, and link with the fortran compiler using the flags:
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++).
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++ .
-lmpicxx is only necessary for openmpi, with mpich it should be omitted.).

And then run with:
```
Expand Down
5 changes: 3 additions & 2 deletions Examples/HydrogenAtom/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ mpicxx main.cc -c \
mpif90 main.o -o example \
-L../../Build/lib -lNTPolyCPP -lNTPolyWrapper -lNTPoly -fopenmp -lstdc++ \
-lblas
-lblas -lmpi_cxx
```

(for the intel compiler, build an intermediate main.o object using the
C++ compiler, and link with the fortran compiler using the flags:
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++).
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++ .
-lmpicxx is only necessary for openmpi, with mpich it should be omitted.).

And then run with:
```
Expand Down
5 changes: 3 additions & 2 deletions Examples/MatrixMaps/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ mpicxx main.cc -c \
mpif90 main.o -o example \
-L../../Build/lib -lNTPolyCPP -lNTPolyWrapper -lNTPoly -fopenmp -lstdc++ \
-lblas
-lblas -lmpi_cxx
```

(for the intel compiler, build an intermediate main.o object using the
C++ compiler, and link with the fortran compiler using the flags:
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++).
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++ .
-lmpicxx is only necessary for openmpi, with mpich it should be omitted.).

And then run with:
```
Expand Down
5 changes: 3 additions & 2 deletions Examples/PremadeMatrix/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ mpicxx main.cc -c \
mpif90 main.o -o example \
-L../../Build/lib -lNTPolyCPP -lNTPolyWrapper -lNTPoly -fopenmp -lstdc++ \
-lblas
-lblas -lmpi_cxx
```

(for the intel compiler, build an intermediate main.o object using the
C++ compiler, and link with the fortran compiler using the flags:
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++).
-qopenmp -cxxlib -nofor_main. When using Clang, use -lc++ instead of -lstdc++ .
-lmpicxx is only necessary for openmpi, with mpich it should be omitted.).

And then run with:
```
Expand Down
2 changes: 1 addition & 1 deletion Source/CPlusPlus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ add_library(NTPolyCPP ${Csrc} ${Chead})
if (NOT NOSWIG)
set_target_properties(NTPolyCPP PROPERTIES POSITION_INDEPENDENT_CODE True)
endif()
target_link_libraries(NTPolyCPP NTPolyWrapper)
target_link_libraries(NTPolyCPP NTPolyWrapper ${MPI_CXX_LIBRARIES})

set_target_properties(NTPolyCPP PROPERTIES PUBLIC_HEADER "${Chead}")
target_include_directories(NTPolyCPP PUBLIC
Expand Down
36 changes: 7 additions & 29 deletions UnitTests/travis_before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,9 @@ if [[ "$TESTOS" == "LINUX" ]]; then
sudo apt-get install gfortran
sudo apt-get install libblas-dev liblapack-dev
if [[ "$MPICH" == "1" ]]; then
sudo apt-get install mpich
sudo apt-get install mpich libmpich-dev
else
if [ -f "openmpi-3.0.1/README" ]; then
echo "Using cached openmpi";
else
wget https://www.open-mpi.org/software/ompi/v3.0/downloads/openmpi-3.0.1.tar.gz;
tar xvf openmpi-3.0.1.tar.gz >/dev/null;
cd openmpi-3.0.1;
./configure >/dev/null 2>&1;
make >/dev/null 2>&1;
fi
cd openmpi-3.0.1
sudo make install >/dev/null 2>&1
cd ../
sudo apt-get install openmpi-bin libopenmpi-dev
fi
fi

Expand All @@ -27,28 +16,17 @@ if [[ "$TESTOS" == "OSX" ]]; then
brew install doxygen
brew install cmake
brew install swig
sudo pip2 install scipy --upgrade --no-cache-dir
sudo pip2 install numpy --upgrade --no-cache-dir
sudo pip2 install scipy --upgrade --no-cache-dir
sudo pip2 install mpi4py --upgrade --no-cache-dir
sudo pip2 install flake8 --upgrade --no-cache-dir
else
sudo ldconfig
sudo apt-get install python-dev
if [[ -z ${SKIPSWIG+x} ]] ; then
if [ -f "swig-3.0.12/README" ]; then
echo "Using cached swig";
else
wget https://downloads.sourceforge.net/swig/swig-3.0.12.tar.gz;
tar xvf swig-3.0.12.tar.gz >/dev/null;
fi
cd swig-3.0.12;
./configure >/dev/null 2>&1;
make >/dev/null 2>&1;
sudo make install >/dev/null 2>&1
cd ../
fi
sudo pip install scipy --upgrade
sudo apt-get install python-dev python-pip python-all-dev
sudo apt-get install python-setuptools python-wheel
sudo apt-get install swig
sudo pip install numpy --upgrade
sudo pip install scipy --upgrade
sudo pip install mpi4py --upgrade
sudo pip install flake8 --upgrade
fi
Expand Down
3 changes: 2 additions & 1 deletion UnitTests/travis_run_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ if [[ "$TESTOS" == "OSX" ]]; then
-DCMAKE_BUILD_TYPE=Release ;
else
if [ ! -z ${NOIALLGATHER+x} ]; then
cmake .. -DNOIALLGATHER=YES -DCMAKE_BUILD_TYPE=Debug ;
cmake .. \
-DCMAKE_BUILD_TYPE=Debug -DNOIALLGATHER=YES;
elif [ ! -z ${DEBUG+x} ]; then
cmake .. -DCMAKE_TOOLCHAIN_FILE=../Targets/Linux.cmake \
-DCMAKE_BUILD_TYPE=Debug ;
Expand Down

0 comments on commit 3dd005b

Please sign in to comment.