diff --git a/README.md b/README.md index b68fc675fce6c404f58c525c3836866b4ca6e48c..1b18cf7998c9955059b1b9d27ffbf5209c7929ea 100644 --- a/README.md +++ b/README.md @@ -17,51 +17,43 @@ SUMMA-Actors depends on the following Libraries: * [C++ Actor Framework](https://github.com/actor-framework/actor-framework) Once the following libraries have been installed SUMMA-Actors can be compiled in -one of two ways. The first way is to modify the makefile directly and the second +one of two ways. The first way is to modify the Makefile directly and the second is to invoke the makefile by shellscript: ### Method 1: Makefile -The method is best used for a workstation build that does not have access to a Compute Canada environment where inlcudes and libraires will need to be explicitly specified. - 1. Makefile: - Changes need to be made to the following variables in the Makefile: - - F_MASTER = directory/above/build - - FC = gfortran - - CC = g++ - - INCLUDES = Path/to/netcdf/includes - - LIBRARIES = Path/to/netcdf/lib & Path/to/openblas - -lnetcdff -lopenblas - - ACTORS_INCLUDES = $INCLUDES & Path/to/CAF/includes - - ACTORS_LIBRARIES = $LIBRARIES & PATH/to/CAF/lib & PATH/to/libsumma.so +The method is best used for a workstation build that does not have access to a Compute Canada Software Stack where includes and libraries will need to be explicitly specified. + +The Makefile is located in the `build` directory and the following variables will need to be uncommented and changed: + - F_MASTER = Path/to/Summa-Actors/ # this is the directory above build/ + - FC = gfortran + - CC = g++ + - INCLUDES = Path/to/netcdf/includes + - LIBRARIES = Path/to/netcdf/lib + Path/to/openblas + -lnetcdff -lopenblas + - ACTORS_INCLUDES = $INCLUDES + Path/to/CAF/includes + - ACTORS_LIBRARIES = $LIBRARIES + PATH/to/CAF/lib + $(F_MASTER)/bin -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff - After the following SUMMA-Actors can be compiled with `make`. +After the following SUMMA-Actors can be compiled with `make`. - Note: SUMMA is compiled as a shared library (libsumma.so) and the main program - will need to know where this library is located in order to properly link it. - By compiling both libsumma.so and summaMain in the same directory (build/) should be - enough. However if there are issues, specifing where libsumma.so will be compiled can be done - by adding the path to `ACTORS_LIBRARIES` in the makefile this should rectify the issues. +Once compiled you will need to set the library path variable with the following command (replace F_Master with the full path to the SUMMA-Actors directory): +`export LD_LIBRARY_PATH=/F_MASTER/bin` + +See section Running SUMMA-Actors for instructions on how to use the program. ### Method 2: Shell Script - 2. ShellScript: - In the build directory exists a example_compile.sh script that can be modified. - This is usually used for HPC computing environments and includes which modules - to load for Compute Canada or the University of Saskatchewan's Copernicus. - example_compile.sh contains instructions on what parts to modify and how to - invoke the makefile from the script. - - Once the shellscript has been modified running it with `source your_script.sh` will compile - SUMMA-Actors. - +This method is best used for cluster environments that have access to the Compute Canada Software Stack. This method has been tested on the University of Saskatchewan's Copernicus and Compute Canada's Graham. This method will invoke the Makefile and no modifications should be made to the Makefile for this method. -After SUMMA-Actors is compiled you should be left with a libsumma.so and a summaMain file -in your build directory. +The compilation script is located in the `build` as `compile_summa.sh`. The only variable within the compile script that needs to be changed is the `F_MASTER` path. This is the absolute path to the SUMMA-Actors directory. -It is important to set the `LD_LIBRARY_PATH` environment variable before attempting to run -summa. This variable needs to point to the location of libsumma.so. If you compiled using the -shellscript using the `source` command and following the directions within the example_compile.sh -this should already be set for you. +Once the F_MASTER path has been specified the following command can be used to build SUMMA-Actors from the build directory: +`source compile_summa.sh` +This script should load all of the required modules from the Compute Canada Software Stack as well as set the environment variable `LD_LIBRARY_PATH` required for running SUMMA-Actors. ## Running Summa-Actors diff --git a/bin/summaMain b/bin/summaMain new file mode 100755 index 0000000000000000000000000000000000000000..24376b8627f7bc2deab79c09fca792fd065ba2e4 Binary files /dev/null and b/bin/summaMain differ diff --git a/build/compile_summa.sh b/build/compile_summa.sh new file mode 100644 index 0000000000000000000000000000000000000000..b0c4affd77b9878f51a746ff332db9b6686b8948 --- /dev/null +++ b/build/compile_summa.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +#### load modules if using Compute Canada or Copernicus #### +module load gcc/9.3.0 +module load netcdf-fortran +module load openblas +module load caf + +#### Specifiy Master Directory, parent of build directory +export F_MASTER= + +#### Specifiy Compilers #### +export FC=gfortran +export CC=g++ + +#### Includes and Libraries #### + +export INCLUDES="-I$EBROOTNETCDFMINFORTRAN/include" +export LIBRARIES="-L$EBROOTNETCDFMINFORTRAN/lib64\ + -L$EBROOTOPENBLAS/lib\ + -lnetcdff -lopenblas" + +# INCLUDES FOR Actors Component +export ACTORS_INCLUDES="-I$EBROOTCAF/include\ + -I$EBROOTNETCDFMINFORTRAN/include" + +export ACTORS_LIBRARIES="-L$EBROOTCAF/lib\ + -L$EBROOTCAF/lib64\ + -L$EBROOTNETCDFMINFORTRAN/lib64\ + -L$EBROOTOPENBLAS/lib\ + -L$F_MASTER/bin\ + -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff" + +#### Compile with the Makefile #### +make -f ${F_MASTER}/build/makefile + + +export LD_LIBRARY_PATH=${F_MASTER}/bin \ No newline at end of file diff --git a/build/example_compile.sh b/build/example_compile.sh deleted file mode 100644 index 1d4307e7774576a6b3a8dee9455b44fd4d03c624..0000000000000000000000000000000000000000 --- a/build/example_compile.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -#### load modules if using Compute Canada or Copernicus #### -# module load gcc/9.3.0 -# module load netcdf-fortran -# module load openblas -# module load caf - -#### Specifiy Master Directory, parent of build directory - -# export F_MASTER=/path/to/summaActors - -#### Specifiy Compilers #### -# export FC=gfortran -# export CC=g++ - -#### Includes and Libraries #### - -# export INCLUDES = NETCDF and OPENBLAS -# export LIBRARIES = NETCDF and OPENBLAS - -# export ACTORS_INCLUDES = C++ Actor Framework -# export ACTORS_LIBRARIES = C++ Actor Framework and -# The directory in which libsumma.so resides - -#### Compile with the Makefile #### -# make -f ${F_MASTER}/build/makefile lib # libsumma.so part - -# mv libsumma.so ${F_MASTER}/bin # optional move of libsumma (just ensure that summaMain knows where to find it) - -# make -f ${F_MASTER}/build/makefile main # summaMain part - -# mv summaMain ${F_MASTER}/bin # optional move, cleans things up - -# export LD_LIBRARY_PATH=Path/to/libsumma.so \ No newline at end of file diff --git a/build/makefile b/build/makefile index bba9de2b724979bb766306d89651004ebbebe3ce..780784218f4d9d529ba0e2fa8c9e6b3340f45612 100644 --- a/build/makefile +++ b/build/makefile @@ -1,18 +1,18 @@ #### parent directory of the 'build' directory #### -# F_MASTER = /home/kklenk/Summa-Actors +# F_MASTER = -# #### fortran compiler #### -# FC = gfortran +#### fortran compiler #### +# FC = -# #### C++ compiler #### -# CC=g++ +#### C++ compiler #### +# CC = -# #### Includes AND Libraries #### -# INCLUDES = -I/usr/include -# LIBRARIES = -L/usr/lib -lnetcdff -lnetcdf -lopenblas +#### Includes AND Libraries #### +# INCLUDES = +# LIBRARIES = -# ACTORS_INCLUDES = -I/usr/include -I/usr/local/include -# ACTORS_LIBRARIES = -L/home/linuxbrew.linuxbrew/lib -L/home/kklenk/Summa-Actors/build -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff +# ACTORS_INCLUDES = +# ACTORS_LIBRARIES = # Production runs @@ -268,6 +268,7 @@ compile_summa: # generate library link: $(FC) -shared *.o -o libsumma.so + mv libsumma.so $(F_MASTER)/bin # compile the c++ portion of SummaActors actors: @@ -275,7 +276,9 @@ actors: actorsLink: $(CC) -o summaMain *.o $(ACTORS_LIBRARIES) + mv summaMain $(F_MASTER)/bin +#### COMPILE TESTING FILES #### actors_test: $(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)