From 1f62eafdf72a51e94ce096d33ca3f93016ff8bae Mon Sep 17 00:00:00 2001 From: MintoDA1 <51412913+MintoDA1@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:02:23 -0400 Subject: [PATCH] rearranged dockerfile and updated the setting of the machine code for Intel processors --- Dockerfile | 36 +++++++++++------------------ cmake/Modules/SetFortranFlags.cmake | 5 ++-- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4b78015f1..569cd3ef5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -98,22 +98,15 @@ ENV NETCDF_LIBRARY=${NETCDF_HOME} ENV FOR_COARRAY_NUM_IMAGES=1 ENV OMP_NUM_THREADS=1 ENV FC="${ONEAPI_ROOT}/mpi/latest/bin/mpiifort" -ENV CC="${ONEAPI_ROOT}/mpi/latest/bin/mpicc -cc=icx" -ENV CXX="${ONEAPI_ROOT}/mpi/latest/bin/mpicc -cc=icpx" +ENV CC="${ONEAPI_ROOT}/mpi/latest/bin/mpicc" +ENV CXX="${ONEAPI_ROOT}/mpi/latest/bin/mpicxx" ENV FFLAGS="-fPIC -standard-semantics" ENV LDFLAGS="-L${INSTALL_DIR}/lib" ENV LIBS="-lhdf5_hl -lhdf5 -lz" ENV PATH /root/miniconda3/bin:$PATH COPY --from=build_deps ${INSTALL_DIR}/. ${INSTALL_DIR}/ -COPY ./cmake/ /swiftest/cmake/ -COPY ./src/ /swiftest/src/ -COPY ./CMakeLists.txt /swiftest/ -COPY ./swiftest/ /swiftest/swiftest/ -COPY ./version.txt /swiftest/ -COPY ./setup.py /swiftest/ -COPY ./requirements.txt /swiftest/ -COPY ./pyproject.toml /swiftest/ + COPY ./environment.yml /swiftest/ RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py311_23.5.2-0-Linux-x86_64.sh && \ @@ -122,6 +115,7 @@ RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py311_23.5.2-0-Linux-x86 source /root/.bashrc && conda update --all -y && \ conda install conda-libmamba-solver -y && \ conda config --set solver libmamba && \ + cd swiftest && \ conda env create -f environment.yml && \ conda init bash && \ echo "conda activate swiftest-env" >> ~/.bashrc && \ @@ -129,18 +123,16 @@ RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py311_23.5.2-0-Linux-x86 conda install -c conda-forge scikit-build -y&& \ conda install -c anaconda cython -y -# RUN cd swiftest && \ -# cmake -S . -B build -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -# -DMACHINE_CODE_VALUE=${MACHINE_CODE_VALUE} \ -# -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -# -DUSE_COARRAY=OFF \ -# -DBUILD_SHARED_LIBS=OFF \ -# ${EXTRA_CMAKE_OPTIONS} && \ -# cmake --build build && \ -# cmake --install build - -# RUN cd swiftest && \ -# pip install . -v +COPY ./cmake/ /swiftest/cmake/ +COPY ./src/ /swiftest/src/ +COPY ./CMakeLists.txt /swiftest/ +COPY ./swiftest/ /swiftest/swiftest/ +COPY ./version.txt /swiftest/ +COPY ./setup.py /swiftest/ +COPY ./requirements.txt /swiftest/ +COPY ./pyproject.toml /swiftest/ +RUN cd swiftest && \ + pip install . -v # This build target creates a container that executes just the driver program FROM ubuntu:20.04 as driver diff --git a/cmake/Modules/SetFortranFlags.cmake b/cmake/Modules/SetFortranFlags.cmake index 400aa6db8..95c7f5d3f 100644 --- a/cmake/Modules/SetFortranFlags.cmake +++ b/cmake/Modules/SetFortranFlags.cmake @@ -144,12 +144,12 @@ IF (NOT BUILD_SHARED_LIBS) ENDIF (NOT BUILD_SHARED_LIBS) IF (USE_SIMD) - SET(MACHINE_CODE_VALUE "host" CACHE STRING "Tells the compiler which processor features it may target, including which instruction sets and optimizations it may generate.") + SET(MACHINE_CODE_VALUE "Host") IF (COMPILER_OPTIONS STREQUAL "Intel") IF (MACHINE_CODE_VALUE STREQUAL "generic") - SET(MACHINE_CODE_VALUE "SSE2") + SET(MACHINE_CODE_VALUE "SSE2" FORCE) # SSE2 is the Intel equivalent of generic ENDIF() # Enables OpenMP SIMD compilation when OpenMP parallelization is disabled. @@ -195,6 +195,7 @@ IF (USE_SIMD) ENDIF () ENDIF () + SET(MACHINE_CODE_VALUE ${MACHINE_CODE_VALUE} CACHE STRING "Tells the compiler which processor features it may target, including which instruction sets and optimizations it may generate.") ENDIF (USE_SIMD)