mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-16 12:54:50 +01:00
Merge branch 'ml/misc' into 'main'
Various changes to build files (CMake & devcontainer) See merge request naaice/poet!38
This commit is contained in:
commit
e31019e957
@ -1,12 +1,53 @@
|
|||||||
FROM mcr.microsoft.com/vscode/devcontainers/base:debian
|
FROM gcc:11.2.0
|
||||||
|
|
||||||
RUN sudo apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
&& sudo apt-get install -y \
|
|
||||||
cmake \
|
RUN apt-get update \
|
||||||
git \
|
&& apt-get install -y \
|
||||||
libeigen3-dev \
|
git \
|
||||||
libopenmpi-dev \
|
sudo \
|
||||||
r-base-dev
|
ninja-build \
|
||||||
|
fzf \
|
||||||
|
libblas-dev && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /tmp
|
||||||
|
|
||||||
|
RUN curl -Ls https://download.open-mpi.org/release/open-mpi/v5.0/openmpi-5.0.5.tar.gz | tar xz && \
|
||||||
|
cd openmpi-5.0.5 && \
|
||||||
|
./configure --prefix=/usr/local && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
rm -rf /tmp/openmpi-5.0.5
|
||||||
|
|
||||||
|
RUN curl -Lo cmake.sh https://github.com/Kitware/CMake/releases/download/v3.30.5/cmake-3.30.5-linux-x86_64.sh \
|
||||||
|
&& bash ./cmake.sh --skip-license --prefix=/usr/local \
|
||||||
|
&& rm cmake.sh
|
||||||
|
|
||||||
|
RUN curl -Ls https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.12.0.tar.gz | tar xz && \
|
||||||
|
cd lapack-3.12.0 && \
|
||||||
|
mkdir build && \
|
||||||
|
cd build && \
|
||||||
|
cmake .. -G Ninja -DBUILD_SHARED_LIBS=ON && \
|
||||||
|
ninja install && \
|
||||||
|
rm -rf /tmp/lapack-3.12.0
|
||||||
|
|
||||||
|
RUN curl -Ls https://cran.r-project.org/src/base/R-4/R-4.4.2.tar.gz | tar xz && \
|
||||||
|
cd R-4.4.2 && \
|
||||||
|
./configure --prefix=/usr/local --enable-R-shlib --with-blas --with-lapack && \
|
||||||
|
make -j $(nproc) && \
|
||||||
|
make install && \
|
||||||
|
rm -rf /tmp/R-4.4.2
|
||||||
|
|
||||||
|
RUN /usr/local/bin/R -q -e "install.packages(c('Rcpp', 'RInside', 'qs'), repos='https://cran.rstudio.com/')"
|
||||||
|
|
||||||
|
RUN curl -Ls https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.bz2 | tar xj \
|
||||||
|
&& mkdir /tmp/eigen-3.4.0/build \
|
||||||
|
&& cd /tmp/eigen-3.4.0/build \
|
||||||
|
&& cmake .. -G Ninja \
|
||||||
|
&& ninja install \
|
||||||
|
&& rm -rf /tmp/eigen-3.4.0
|
||||||
|
|
||||||
RUN git clone https://github.com/doctest/doctest.git /doctest \
|
RUN git clone https://github.com/doctest/doctest.git /doctest \
|
||||||
&& cd /doctest \
|
&& cd /doctest \
|
||||||
@ -14,7 +55,16 @@ RUN git clone https://github.com/doctest/doctest.git /doctest \
|
|||||||
&& cd build \
|
&& cd build \
|
||||||
&& cmake .. \
|
&& cmake .. \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& cd / \
|
|
||||||
&& rm -rf /doctest
|
&& rm -rf /doctest
|
||||||
|
|
||||||
RUN /usr/bin/R -q -e "install.packages(c('Rcpp', 'RInside'))"
|
RUN useradd -m -s /bin/bash -G sudo vscode \
|
||||||
|
&& echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||||
|
|
||||||
|
USER vscode
|
||||||
|
|
||||||
|
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.1/zsh-in-docker.sh)" -- \
|
||||||
|
-t agnoster
|
||||||
|
|
||||||
|
WORKDIR /home/vscode
|
||||||
|
|||||||
@ -21,7 +21,8 @@
|
|||||||
},
|
},
|
||||||
// in case you want to push/pull from remote repositories using ssh
|
// in case you want to push/pull from remote repositories using ssh
|
||||||
"mounts": [
|
"mounts": [
|
||||||
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
|
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
|
||||||
|
"source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached"
|
||||||
]
|
]
|
||||||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||||
// "remoteUser": "devcontainer"
|
// "remoteUser": "devcontainer"
|
||||||
|
|||||||
@ -1,28 +1,27 @@
|
|||||||
# prepare R environment (Rcpp + RInside)
|
# prepare R environment (Rcpp + RInside)
|
||||||
find_program(R_EXE "R")
|
find_program(R_EXE "R"
|
||||||
|
REQUIRED
|
||||||
|
)
|
||||||
|
|
||||||
# search for R executable, R header file and library path
|
# search for R executable, R header file and library path
|
||||||
if(R_EXE)
|
execute_process(
|
||||||
execute_process(
|
COMMAND ${R_EXE} RHOME
|
||||||
COMMAND ${R_EXE} RHOME
|
OUTPUT_VARIABLE R_ROOT_DIR
|
||||||
OUTPUT_VARIABLE R_ROOT_DIR
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
)
|
||||||
)
|
|
||||||
|
|
||||||
find_path(
|
find_path(
|
||||||
R_INCLUDE_DIR R.h
|
R_INCLUDE_DIR R.h
|
||||||
HINTS ${R_ROOT_DIR}
|
HINTS /usr/include /usr/local/include /usr/share ${R_ROOT_DIR}/include
|
||||||
PATHS /usr/include /usr/local/include /usr/share
|
PATH_SUFFIXES R/include R
|
||||||
PATH_SUFFIXES include/R R/include
|
REQUIRED
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(
|
find_library(
|
||||||
R_LIBRARY libR.so
|
R_LIBRARY libR.so
|
||||||
HINTS ${R_ROOT_DIR}/lib
|
HINTS ${R_ROOT_DIR}/lib
|
||||||
)
|
REQUIRED
|
||||||
else()
|
)
|
||||||
message(FATAL_ERROR "No R runtime found!")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(R_LIBRARIES ${R_LIBRARY})
|
set(R_LIBRARIES ${R_LIBRARY})
|
||||||
set(R_INCLUDE_DIRS ${R_INCLUDE_DIR})
|
set(R_INCLUDE_DIRS ${R_INCLUDE_DIR})
|
||||||
@ -71,11 +70,8 @@ list(APPEND R_INCLUDE_DIRS ${R_RInside_INCLUDE_DIR})
|
|||||||
# putting all together into interface library
|
# putting all together into interface library
|
||||||
|
|
||||||
add_library(RRuntime INTERFACE IMPORTED)
|
add_library(RRuntime INTERFACE IMPORTED)
|
||||||
set_target_properties(
|
target_link_libraries(RRuntime INTERFACE ${R_LIBRARIES})
|
||||||
RRuntime PROPERTIES
|
target_include_directories(RRuntime INTERFACE ${R_INCLUDE_DIRS})
|
||||||
INTERFACE_LINK_LIBRARIES "${R_LIBRARIES}"
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${R_INCLUDE_DIRS}"
|
|
||||||
)
|
|
||||||
|
|
||||||
unset(R_LIBRARIES)
|
unset(R_LIBRARIES)
|
||||||
unset(R_INCLUDE_DIRS)
|
unset(R_INCLUDE_DIRS)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user