...
 
Commits (6)
......@@ -4,12 +4,14 @@
# CMake configuration options
# - Default build type: Release
# - If installed, place into "/opt/dorie"
# - Create virtual environment in dune-common
# - Fetch pip and install it into virtual environment
# - Prefer parallel over sequential HDF5 (required for Ubuntu/Debian)
CMAKE_FLAGS="
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=/opt/dorie
-DDUNE_PYTHON_VIRTUALENV_SETUP=True
-DDUNE_PYTHON_ALLOW_GET_PIP=True
-DHDF5_PREFER_PARALLEL=True
......
......@@ -106,13 +106,21 @@ function(dorie_compile_instance)
target_link_libraries(${exe_name} PUBLIC --coverage)
endif()
# Add the executable to the default targets
# Handling of default targets
if (ARGS_RORDER LESS_EQUAL DORIE_MAX_DEFAULT_RORDER_${ARGS_DIMENSION})
if (ARGS_MODEL STREQUAL "richards")
if (ARGS_MODEL STREQUAL "richards"
OR ((ARGS_TORDER LESS_EQUAL DORIE_MAX_DEFAULT_TORDER_${ARGS_DIMENSION})
AND (ARGS_RORDER EQUAL ARGS_TORDER)))
# Make dependency of model meta-target
add_dependencies(${ARGS_MODEL} ${exe_name})
elseif ((ARGS_TORDER LESS_EQUAL DORIE_MAX_DEFAULT_TORDER_${ARGS_DIMENSION})
AND (ARGS_RORDER EQUAL ARGS_TORDER))
add_dependencies(${ARGS_MODEL} ${exe_name})
# Add installation instructions
include(GNUInstallDirs)
install(TARGETS ${exe_name}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_WRITE WORLD_EXECUTE)
endif()
endif()
......
......@@ -174,3 +174,24 @@ create_default_config(
configure_file(${CMAKE_CURRENT_BINARY_DIR}/config.ini
${CMAKE_CURRENT_SOURCE_DIR}/config.ini
COPYONLY)
# Install default files
include(GNUInstallDirs)
install(
FILES
# BCs
${CMAKE_CURRENT_BINARY_DIR}/richards_bc.yml
${CMAKE_CURRENT_BINARY_DIR}/transport_bc.yml
# Parameter files
${CMAKE_CURRENT_BINARY_DIR}/richards_param.yml
${CMAKE_CURRENT_BINARY_DIR}/transport_param.yml
# Config files
${CMAKE_CURRENT_BINARY_DIR}/config.ini
${CMAKE_CURRENT_BINARY_DIR}/parfield.ini
# Cheat Sheets
${CMAKE_CURRENT_BINARY_DIR}/parameters.html
${CMAKE_CURRENT_BINARY_DIR}/field-parameters.html
DESTINATION
${CMAKE_INSTALL_DOCDIR}/default_files/
)
......@@ -14,24 +14,30 @@ ARG PROCNUM=1
WORKDIR /opt/dune/dorie
COPY ./ ./
# build the executable
# Build and install DORiE
WORKDIR /opt/dune/
RUN MAKE_FLAGS="-j${PROCNUM}" \
./dune-common/bin/dunecontrol --opts=dorie/build.opts --only=dorie all
./dune-common/bin/dunecontrol --opts=dorie/build.opts --only=dorie all \
&& ./dune-common/bin/dunecontrol --only=dorie make install
# Start a fresh image as production environment
FROM $DUNE_ENV_IMAGE as prod-env
# Copy binaries, Python venv, and Python scripts (editable install)
WORKDIR /opt/dune
COPY --from=build-env /opt/dune/dune-common/build-cmake/dune-env ./dune-common/build-cmake/dune-env
WORKDIR /opt/dune/dorie
COPY --from=build-env /opt/dune/dorie/build-cmake ./build-cmake/
COPY --from=build-env /opt/dune/dorie/python ./python/
# Copy binaries and Python venv
# NOTE: Python venv must remain in the same directory!
WORKDIR /opt/
COPY --from=build-env /opt/dune/dune-common/build-cmake/dune-env /opt/dune/dune-common/build-cmake/dune-env
COPY --from=build-env /opt/dune/dune-common/build-cmake/run-in-dune-env /opt/dune/dune-common/build-cmake
WORKDIR /opt/dorie
COPY --from=build-env /opt/dorie ./
# Tell CLI that we are using a DORiE installation
ENV DORIE_INSTALL_DIR /opt/dorie
# move to working directory
WORKDIR /mnt
# run bash in the virtualenv (this actually creates two bash instances...)
# TODO: create new user with restricted privileges
ENTRYPOINT ["/opt/dune/dune-common/build-cmake/run-in-dune-env", "/bin/bash"]
ENTRYPOINT [ "/opt/dune/dune-common/build-cmake/run-in-dune-env" ]
CMD ["/bin/bash" ]
add_executable(dorie-rfg dorie-rfg.cc)
dune_target_link_libraries(dorie-rfg ${DUNE_LIBS})
# Add installation instructions
include(GNUInstallDirs)
install(TARGETS dorie-rfg
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_WRITE WORLD_EXECUTE)
......@@ -10,15 +10,23 @@ try: # Python 2.x compatibility
except NameError:
pass
# paths set by cmake
DORIEDIR = "@PROJECT_BINARY_DIR@"
EXECUTABLE_PATH = "@DORIE_EXE_PATH@"
# Extract installation path from environment
DORIE_INSTALL_DIR = os.environ.get('DORIE_INSTALL_DIR')
# Build tree paths
DORIE_BUILD_DIR = "@PROJECT_BINARY_DIR@"
EXE_BUILD_DIR = "@DORIE_EXE_PATH@"
# Install tree paths
EXE_INSTALL_DIR = os.path.join(DORIE_INSTALL_DIR, "@CMAKE_INSTALL_BINDIR@")
DOC_INSTALL_DIR = os.path.join(DORIE_INSTALL_DIR, "@CMAKE_INSTALL_DOCDIR@")
# MPI settings
MPIEXEC = "@MPIEXEC@"
MPIEXEC_NUMPROC_FLAG = "@MPIEXEC_NUMPROC_FLAG@"
MPIEXEC_PREFLAG = "@MPIEXEC_PREFLAG@"
MPIEXEC_POSTFLAGS = "@MPIEXEC_POSTFLAGS@"
PARAMETERDIR = os.path.join(DORIEDIR, "doc/default_files")
def MPIRUN(nproc,exe,*args,**kwargs):
mpi_flags = kwargs.get("mpi_flags") or []
return [k for k in [MPIEXEC,MPIEXEC_NUMPROC_FLAG,str(nproc)] \
......@@ -27,6 +35,8 @@ def MPIRUN(nproc,exe,*args,**kwargs):
def get_executable(config):
"""Return the target executable given a config tree."""
EXECUTABLE_PATH = EXE_INSTALL_DIR if DORIE_INSTALL_DIR else EXE_BUILD_DIR
mode = config["simulation.mode"]
# default executables
......@@ -76,6 +86,10 @@ def run(args):
sys.exit(1)
def create(args):
PARAMETERDIR = (os.path.join(DOC_INSTALL_DIR, 'default_files')
if DORIE_INSTALL_DIR else os.path.join(DORIE_BUILD_DIR,
'doc/default_files'))
for f in ("config.ini",
"parfield.ini",
"richards_bc.yml",
......