Skip to content

Commit

Permalink
Merge pull request #31 from ucns3d-team/feature/fix-docker-builder
Browse files Browse the repository at this point in the history
Feature/fix docker builder
  • Loading branch information
TakisCFD committed Aug 1, 2022
2 parents 76f735d + ef86cac commit eacc03d
Show file tree
Hide file tree
Showing 33 changed files with 150 additions and 100 deletions.
15 changes: 7 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Prerequisites
*.d
# *.d

# Compiled Object files
*.slo
Expand All @@ -12,19 +12,18 @@
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# *.so
# *.dylib
# *.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# *.lai
# *.la
# *.lib

# Executables
*.exe
Expand Down
38 changes: 22 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ RUN apt-get update && \
libcgal-dev \
libmpc-dev \
# ping \
nano \
libstdc++5 \
libiberty-dev \
software-properties-common ;\
Expand All @@ -45,27 +46,31 @@ RUN apt-get update && \

WORKDIR /root/

#RUN mkdir -p /root/local ;\
# cd /root/local \
# cd /root/ ;\
# pwd ;\
# git clone https://github.com/KarypisLab/GKlib.git
# Download and install GKlib, metis and parmetis dependencies

#RUN make -C /root/GKlib prefix=/root/local config
#RUN cd /root/GKlib && make install
RUN mkdir -p /root/local ;\
cd /root/ ;\
git clone https://github.com/KarypisLab/GKlib.git

#RUN cd /root/ ;\
# git clone https://github.com/KarypisLab/METIS.git
#RUN make -C /root/METIS config shared=1 cc=gcc prefix=/root/local
#RUN cd /root/METIS && make install
RUN make -C /root/GKlib config cc=gcc prefix=/root/local
RUN cd /root/GKlib && make install

RUN cd /root/ ;\
git clone https://github.com/KarypisLab/METIS.git
RUN make -C /root/METIS config cc=gcc prefix=/root/local
RUN cd /root/METIS && make install

#RUN cd /root/ ;\
# git clone https://github.com/KarypisLab/ParMETIS.git
#RUN make -C /root/ParMETIS config cc=mpicc prefix=/root/local
#RUN cd /root/ParMETIS && make install
RUN cd /root/ ;\
git clone https://github.com/KarypisLab/ParMETIS.git
RUN make -C /root/ParMETIS config cc=mpicc prefix=/root/local
RUN cd /root/ParMETIS && make install

# Add src and compile
ADD src /root/CODE
RUN cd /root/CODE && make -f Makefile_docker clean all
# Add tecplot dependency
# TODO build the download and compilation of libtecio.a
ADD bin/lib/tecplot/libtecio.a /root/CODE
RUN cd /root/CODE && make -f Makefile_docker all
ENV OMPI_MCA_btl_vader_single_copy_mechanism=none

# Make & set a rundir & copy executable
Expand All @@ -83,3 +88,4 @@ WORKDIR /ucns3d_run
COPY tests/taylor_green_vortex/* /ucns3d_run/
COPY tests/execute-tests.sh /ucns3d_run/
RUN chmod +x execute-tests.sh
RUN sed -i -e 's/\r$//' /ucns3d_run/execute-tests.sh
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ There are two main methods to locally install the solver and run the solver.
2. In your bash terminal build the ucns3d image, you would need invoke `docker build` from the repository root directory:

```
$ docker build . -t ucns3d -f Dockerfile
docker build . -t ucns3d -f Dockerfile
```

3. Once the image is build run the image, you can run the image interactively like so:

```
$ docker run -ti ucns3d
docker run -ti ucns3d
```

The current [Dockerfile](Dockerfile) contains an example case under [tests](/tests/execute-tests.sh). Alternatively, you can mount a tmp directory and copy other uses cases when you run the image like so:

```
$ docker run -v $PWD/tmp/:/tmp/ -ti ucns3d
docker run -v $PWD/tmp/:/tmp/ -ti ucns3d
```

### Manual Build
Expand Down Expand Up @@ -86,11 +86,11 @@ compiler options.

* For a clean installation
```
$ make -f Makefile clean all
make -f Makefile clean all
```
* For recompiling changed files and their dependencies
```
$ make -f Makefile
make -f Makefile
```
* the name of the executable is `ucns3d_p`.

Expand All @@ -104,12 +104,12 @@ For running ucns3d you will need the following files in a directory of your choi
* the executable ucns3d_p
* For interactively running the code specify the number of threads to be used by typing in the terminal window
```
$ export OMP_NUM_THREADS=N
export OMP_NUM_THREADS=N
```
N being the number of threads to be used (use 1 for MPI only mode)
* in the same terminal window run the code by typing
```
$ mpirun -np M ./ucns3d_p
mpirun -np M ./ucns3d_p
```
M being the number of MPI processes (at least 2 are required), for running at different HPC systems sample [scripts](/scripts) and [libraries](/bin/lib) are provided.

Expand Down
2 changes: 1 addition & 1 deletion bin/gnu-compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ LIBS = -Wl,-Bstatic libparmetis.a libmetis.a libtecio.a $(BLASLIBS) -Wl,-Bdynami
# LIBS = libparmetis.a libmetis.a libtecio.a $(BLASLIBS) -lstdc++


include Makefile.common
include Makefile_common



Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ LIBS = -Wl,-Bstatic libparmetis_gnu_mpi.a libmetis.a libtecio.a $(BLASLIBS) -Wl,
#LIBS = libparmetis.a libmetis.a libtecio.a $(BLASLIBS) -lstdc++


include Makefile.common
include Makefile_common



3 changes: 3 additions & 0 deletions bin/gnu-compiler/archer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Setup for archer Supercomputer

These are libraries that work with gnu and cray ftn compilers on archer.
62 changes: 62 additions & 0 deletions bin/gnu-compiler/docker-ubuntu/Makefile_docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## Makefile to be build in Docker.

##intel
# F90=mpiifort
#GFORTRAN
F90=mpif90
LD=$(F90)
# ifdef HPCTOOLKIT
# $(info HPCToolkit is loaded - building version for profiling)
# DBGFLAGS=-g -debug inline-debug-info
# else
# $(info HPCToolkit is not loaded - building release version)
# DBGFLAGS=
# endif


#intel MKL
# BLASFLAGS= -I${MKLROOT}/include
# BLASLIBS= -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl

BLASFLAGS= -I /usr/include/x86_64-linux-gnu/openblas-pthread #Ensure that you include your BLAS library path here
BLASLIBS= /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.a #Ensure that you include your BLAS library path here
GKLIB= /root/local/lib/libGKlib.a
METISLIB= /root/local/lib/libmetis.a
PARMETISLIB= /root/local/lib/libparmetis.a


#amdblis aocl
#BLASFLAGS= -I/opt/hlrs/non-spack/libraries/aocl-gcc/2.1.0/amd-blis/include/
#BLASLIBS= /opt/hlrs/non-spack/libraries/aocl-gcc/2.1.0/amd-blis/lib/libblis.a

# OFLAGS=
# #intel compilers
# # debug run
# #FFLAGS=-i4 -r8 -O0 -g -debug all -xHost -traceback -qopenmp -qopenmp-link=static $(BLASFLAGS) -check bounds -fp-model strict -debug inline-debug-info -zero
# # production run
# #FFLAGS=-i4 -r8 -ipo -march=core-avx2 -mtune=core-avx2 -O3 -fp-model precise -zero -qopenmp -qopenmp-link=static $(BLASFLAGS) #amd zen
# FFLAGS=-i4 -r8 -ipo -xHost -O3 -fp-model precise -zero -qopenmp -qopenmp-link=static $(BLASFLAGS)


#gfortran
#debug run
#FFLAGS=-ffree-line-length-none -fdefault-real-8 -fopenmp -Wall -fbounds-check -finit-local-zero -fdump-parse-tree -fdump-core -fbacktrace -fdefault-double-8 -fbackslash -O0 -fcray-pointer -Wno-lto-type-mismatch -fPIE $(BLASFLAGS)
#production run
FFLAGS=-fdefault-real-8 -fdefault-double-8 -fbackslash -fopenmp -ffree-line-length-none -finit-local-zero -fimplicit-none -flto -fcray-pointer -O3 -march=native -Wno-lto-type-mismatch -fPIE $(BLASFLAGS)

#aocl
#FFLAGS= -O3 -Mfreeform -Mallocatable=03 -Mdaz -fdefault-real-8 -fopenmp -mavx2 -march=znver2 $(BLASFLAGS)
#FFLAGS= -O2 -mp -fdefault-real-8 -flto -fopenmp -mavx2 -march=znver2 $(BLASFLAGS)

#gnu hybrid static dynamic
# LIBS = -Wl,-Bstatic libparmetis.a libmetis.a libtecio.a $(BLASLIBS) -Wl,-Bdynamic -lstdc++ -lpthread -lm -ldl -lc -lmpi
LIBS = -Wl,-V,-Bstatic libtecio.a $(BLASLIBS) $(GKLIB) $(METISLIB) $(PARMETISLIB) -Wl,-Bdynamic -lstdc++ -lpthread -lm -ldl -lc -lmpi


#intel static linking
# LIBS = libparmetis.a libmetis.a libtecio.a $(BLASLIBS) -lstdc++

include Makefile_common



2 changes: 1 addition & 1 deletion bin/intel-compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ FFLAGS=-i4 -r8 -ipo -xHost -O3 -fp-model precise -zero -qopenmp -qopenmp-link=s
LIBS = libparmetis.a libmetis.a libtecio.a $(BLASLIBS) -lstdc++


include Makefile.common
include Makefile_common



3 changes: 3 additions & 0 deletions bin/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Static libraries required to compile and run UCNS3D

Precompiled metis, parmetis and tecplot static libraries. They can be used to link during compilation.
Binary file removed bin/lib/archer/libparmetis.a
Binary file not shown.
1 change: 0 additions & 1 deletion bin/lib/archer/readme.txt

This file was deleted.

Binary file removed bin/lib/libmetis.a
Binary file not shown.
Binary file removed bin/lib/libtecio.a
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
48 changes: 31 additions & 17 deletions bin/macos/readme.txt → bin/macos/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
. Use the following dynamic libraries:
# Setup on MacOS

Use the following dynamic libraries:
libmetis.dylib (Compiled from source)
libparmetis.dylib (Compiled from source)
libtecio.dylib (Copied from Tecplot executable)
Expand All @@ -7,37 +9,49 @@ The above are also provided in this folder but probably won't work, you will hav
--------------------------------------------------
Locate the required libraries:

1) Download and install the latest free trial of tecpot, then the dynamic library (libtecio.dylib), is available in 360’s folder, Tecplot 360 EX 2021 r1 /Contents/Frameworks/ (you can run ucns3d without tecplot, and you can use a vtk output but this is required for compiling only)
1. Download and install the latest free trial of tecpot, then the dynamic library (libtecio.dylib), is available in 360’s folder, Tecplot 360 EX 2021 r1 /Contents/Frameworks/ (you can run ucns3d without tecplot, and you can use a vtk output but this is required for compiling only)

2) Download the latest version of parmetis and in the CMakeLists.txt of the parmetis directory, in the section starting with: if(SHARED) you should add:
2. Download the latest version of parmetis and in the CMakeLists.txt of the parmetis directory, in the section starting with: if(SHARED) you should add:
set(METIS_LIBRARY_TYPE SHARED)

a. Then open a terminal window in the parmetis directory and execute the following commands
i. make config shared=1
ii. make
b. Then you can use the generated libmetis.dylib and libparmetis.dylib from your directory parmetis/build/Darwin…./libmetis/ and parmetis/build/Darwin…./libparmetis/ respectively
2.1. Then open a terminal window in the parmetis directory and execute the following commands

```
make config shared=1
```
```
make
```

2.2. Then you can use the generated libmetis.dylib and libparmetis.dylib from your directory parmetis/build/Darwin…./libmetis/ and parmetis/build/Darwin…./libparmetis/ respectively

3) Install OpenBlas with Homebrew and modify the Makefile to point to the correct location of the libraries.
3. Install OpenBlas with Homebrew and modify the Makefile to point to the correct location of the libraries.

--------------------------------------------------------

4. Use the Makefile.common and Makefile for MacOS from this folder and copy to the src directory

2. Use the Makefile.common and Makefile for MacOS from this folder and copy to the src directory
5. Open a terminal window and compile as:

3. Open a terminal window and compile as:
```
make -f Makefile clean all (this is for new make and clean)
or
make -f Makefile
```

```
make -f Makefile
```

4. Type the following in a terminal window prior to running the application
6. Type the following in a terminal window prior to running the application

```
install_name_tool -change @rpath/libtecio.dylib /Users/Username/code_directory/libtecio.dylib /Users/Username/executable_directory/executable_name
```



5. Type the following in a terminal window (values for A greater than or equal to 1, and B greater than 1)
7. Type the following in a terminal window (values for A greater than or equal to 1, and B greater than 1)
```
export OMP_NUM_THREADS=A
```
```
mpirun -np B ./ucns3d_p
```

6. Enjoy!
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions bin/translators/README.txt → scripts/translators/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Scripts to translate input formats

these translators can be compiled with the following command to translate meshes generated in STAR CD format or UGRID format
to native UCNS3D binary format

compile with

ifort -i4 -r8 "name of .f90 file"
compile with and run

execute
```
ifort -i4 -r8 ".f90"
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 6 additions & 44 deletions src/Makefile_docker
Original file line number Diff line number Diff line change
@@ -1,57 +1,19 @@
## Makefile to be build in Docker.
# Makefile to be build with Docker.

##intel
# F90=mpiifort
#GFORTRAN
F90=mpif90
LD=$(F90)
# ifdef HPCTOOLKIT
# $(info HPCToolkit is loaded - building version for profiling)
# DBGFLAGS=-g -debug inline-debug-info
# else
# $(info HPCToolkit is not loaded - building release version)
# DBGFLAGS=
# endif


#intel MKL
# BLASFLAGS= -I${MKLROOT}/include
# BLASLIBS= -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl

BLASFLAGS= -I /usr/include/x86_64-linux-gnu/openblas-pthread #Ensure that you include your BLAS library path here
BLASLIBS= /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.a #Ensure that you include your BLAS library path here
#PARMETISLIBS= /root/local/lib/libparmetis.a

#amdblis aocl
#BLASFLAGS= -I/opt/hlrs/non-spack/libraries/aocl-gcc/2.1.0/amd-blis/include/
#BLASLIBS= /opt/hlrs/non-spack/libraries/aocl-gcc/2.1.0/amd-blis/lib/libblis.a

# OFLAGS=
# #intel compilers
# # debug run
# #FFLAGS=-i4 -r8 -O0 -g -debug all -xHost -traceback -qopenmp -qopenmp-link=static $(BLASFLAGS) -check bounds -fp-model strict -debug inline-debug-info -zero
# # production run
# #FFLAGS=-i4 -r8 -ipo -march=core-avx2 -mtune=core-avx2 -O3 -fp-model precise -zero -qopenmp -qopenmp-link=static $(BLASFLAGS) #amd zen
# FFLAGS=-i4 -r8 -ipo -xHost -O3 -fp-model precise -zero -qopenmp -qopenmp-link=static $(BLASFLAGS)
GKLIB= /root/local/lib/libGKlib.a
METISLIB= /root/local/lib/libmetis.a
PARMETISLIB= /root/local/lib/libparmetis.a


#gfortran
#debug run
#FFLAGS=-ffree-line-length-none -fdefault-real-8 -fopenmp -Wall -fbounds-check -finit-local-zero -fdump-parse-tree -fdump-core -fbacktrace -fdefault-double-8 -fbackslash -O0 -fcray-pointer -Wno-lto-type-mismatch -fPIE $(BLASFLAGS)
#production run
FFLAGS=-fdefault-real-8 -fdefault-double-8 -fbackslash -fopenmp -ffree-line-length-none -finit-local-zero -fimplicit-none -flto -fcray-pointer -O3 -march=native -Wno-lto-type-mismatch -fPIE $(BLASFLAGS)

#aocl
#FFLAGS= -O3 -Mfreeform -Mallocatable=03 -Mdaz -fdefault-real-8 -fopenmp -mavx2 -march=znver2 $(BLASFLAGS)
#FFLAGS= -O2 -mp -fdefault-real-8 -flto -fopenmp -mavx2 -march=znver2 $(BLASFLAGS)

#gnu hybrid static dynamic
LIBS = -Wl,-Bstatic libparmetis.a libmetis.a libtecio.a $(BLASLIBS) -Wl,-Bdynamic -lstdc++ -lpthread -lm -ldl -lc -lmpi

#intel static linking
# LIBS = libparmetis.a libmetis.a libtecio.a $(BLASLIBS) -lstdc++
LIBS = -Wl,-V,-Bstatic libtecio.a $(BLASLIBS) $(GKLIB) $(METISLIB) $(PARMETISLIB) -Wl,-Bdynamic -lstdc++ -lpthread -lm -ldl -lc -lmpi

include Makefile.common
include Makefile_common



File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit eacc03d

Please sign in to comment.