Skip to content

Commit

Permalink
Remove deprecated build hacks. Includes move to CCE18 (Frontier) (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
henryleberre authored Sep 13, 2024
1 parent 32b764e commit 2d1de77
Show file tree
Hide file tree
Showing 23 changed files with 95 additions and 466 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/docker.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/frontier/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

. ./mfc.sh load -c f -m g
./mfc.sh build -j 8 --gpu --sys-hdf5 --sys-fftw
./mfc.sh build -j 8 --gpu
2 changes: 1 addition & 1 deletion .github/workflows/frontier/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
gpus=`rocm-smi --showid | awk '{print $1}' | grep -Eo '[0-9]+' | uniq | tr '\n' ' '`
ngpus=`echo "$gpus" | tr -d '[:space:]' | wc -c`

./mfc.sh test --max-attempts 3 -j $ngpus --sys-hdf5 --sys-fftw -- -c frontier
./mfc.sh test --max-attempts 3 -j $ngpus -- -c frontier

36 changes: 9 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,17 @@ jobs:

- name: Setup MacOS
if: matrix.os == 'macos'
run: |
brew install wget make python make cmake coreutils gcc@14
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
run: |
brew install coreutils python cmake fftw hdf5 gcc@14 open-mpi
echo "FC=gfortran-14" >> $GITHUB_ENV
- name: (MacOS) Build OpenMPI
if: matrix.os == 'macos' && matrix.mpi == 'mpi'
run: |
brew install mpich
- name: Setup Ubuntu
if: matrix.os == 'ubuntu' && matrix.intel == false
run: |
sudo apt update -y
sudo apt install -y tar wget make cmake gcc g++ python3 python3-dev "openmpi-*" libopenmpi-dev
sudo apt install -y cmake gcc g++ python3 python3-dev hdf5-tools \
libfftw3-dev libhdf5-dev openmpi-bin libopenmpi-dev
- name: Setup Ubuntu (Intel)
if: matrix.os == 'ubuntu' && matrix.intel == true
run: |
Expand All @@ -83,34 +77,22 @@ jobs:
echo "OMPI_FC=$(which ifort)" >> $GITHUB_ENV
echo "OMPI_CXX=$(which icpc)" >> $GITHUB_ENV
echo "OMPI_MPICC=$(which icc)" >> $GITHUB_ENV
echo "MPI_HOME=/opt/intel/oneapi/mpi/2021.7.1/" >> $GITHUB_ENV
echo "I_MPI_ROOT=/opt/intel/oneapi/mpi/2021.7.1/" >> $GITHUB_ENV
echo "MPI_HOME=/opt/intel/oneapi/mpi/2021.7.1/" >> $GITHUB_ENV
echo "I_MPI_ROOT=/opt/intel/oneapi/mpi/2021.7.1/" >> $GITHUB_ENV
- name: Build
run: |
if [ '${{ matrix.intel }}' == 'true' ]; then source /opt/intel/oneapi/setvars.sh; fi
if [ '${{ matrix.intel }}' == 'true' ]; then . /opt/intel/oneapi/setvars.sh; fi
/bin/bash mfc.sh build -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }}
- name: Test
run: |
if [ '${{ matrix.intel }}' == 'true' ]; then source /opt/intel/oneapi/setvars.sh; fi
if [ '${{ matrix.intel }}' == 'true' ]; then . /opt/intel/oneapi/setvars.sh; fi
/bin/bash mfc.sh test --max-attempts 3 -j $(nproc) $OPT1 $OPT2
env:
OPT1: ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
OPT2: ${{ matrix.debug == 'debug' && '-% 20' || '' }}

docker:
name: Github | Docker
if: needs.file-changes.outputs.checkall == 'true'
needs: file-changes
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4

- name: Test
run: sudo ./mfc.sh docker ./mfc.sh test --max-attempts 3 -j $(nproc) -a

self:
name: Self Hosted
if: github.repository == 'MFlowCode/MFC' && needs.file-changes.outputs.checkall == 'true'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules/
package.json
yarn.lock
docker-compose.yml

.venv/
/build/
Expand Down
14 changes: 4 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ find_program(FYPP_EXE fypp REQUIRED)

link_libraries("${CMAKE_DL_LIBS}")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/cmake")
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/cmake/regular")
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/cmake/cce")
endif()


# Compiler Flags: Here, we specify our own compiler flags for both release and
Expand Down Expand Up @@ -526,15 +529,6 @@ if (MFC_SIMULATION)
MFC_SETUP_TARGET(TARGET simulation
SOURCES "${simulation_SRCs}"
MPI OpenACC FFTW)

if (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray" AND MFC_OpenACC)
add_custom_command(TARGET simulation POST_BUILD
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/cce_simulation_workgroup_256.sh"
"${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Patching & Rebuilding with Cray hacks"
)
endif()
endif()

if (MFC_POST_PROCESS)
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,14 @@ It's rather straightforward.
We'll give a brief intro. here for MacOS.
Using [brew](https://brew.sh), install MFC's dependencies:
```shell
brew install wget python cmake gcc@14 mpich
brew install coreutils python cmake fftw hdf5 gcc open-mpi
```
You're now ready to build and test MFC!
Put it to a convenient directory via
```shell
git clone https://github.com/MFlowCode/MFC
cd MFC
```
and be sure MFC knows what compilers to use by appending and sourcing your `~/.profile` file via this command
```shell
echo -e "export CC=gcc-14 \nexport CXX=g++-14 \nexport FC=gfortran-14" >> ~/.profile
source ~/.profile
```
then you can build MFC and run the test suite!
```shell
./mfc.sh build -j $(nproc)
Expand Down
94 changes: 8 additions & 86 deletions docs/documentation/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,10 @@ Please select your desired configuration from the list bellow:
```shell
sudo apt update
sudo apt upgrade
sudo apt install tar wget make cmake gcc g++ \
python3 python3-dev \
"openmpi-*" libopenmpi-dev \
python3-venv
```

- **Via Pacman (Arch):**

```shell
sudo pacman -Syu
sudo pacman -S base-devel coreutils \
git ninja gcc-fortran \
cmake openmpi python3 \
python-pip openssh \
python-virtualenv vim \
wget tree
sudo apt install tar wget make cmake gcc g++ \
python3 python3-dev python3-venv \
openmpi-bin libopenmpi-dev \
libhdf5-dev libfftw3-dev
```

If you wish to build MFC using [NVidia's NVHPC SDK](https://developer.nvidia.com/hpc-sdk),
Expand All @@ -55,8 +43,8 @@ first follow the instructions [here](https://developer.nvidia.com/nvidia-hpc-sdk
<summary><h2>Windows</h2></summary>

On Windows, you can either use Intel Compilers with the standard Microsoft toolchain,
[Docker](https://docs.docker.com/get-docker/) or the
[Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/) for a Linux experience.
or the [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/)
for a Linux experience.

<details>

Expand Down Expand Up @@ -113,82 +101,16 @@ You will also have access to the `.sln` Microsoft Visual Studio solution files f
<details>
<summary><h3>MacOS</h3></summary>

- **If you use [ZSH]** (Verify with `echo $SHELL`)
Using [Homebrew](https://brew.sh/) you can install the necessary dependencies:

```shell
touch ~/.zshrc
open ~/.zshrc
```

- **If you use [BASH]** (Verify with `echo $SHELL`)

```shell
touch ~/.bash_profile
open ~/.bash_profile
```

An editor should open.
Please paste the following lines into it before saving the file.
Modify the first assignment if you wish to use a different version of GNU's GCC.
These lines ensure that LLVM's Clang and Apple's modified version of GCC are not used to compile MFC.
Further reading on `open-mpi` incompatibility with `clang`-based `gcc` on macOS: [here](https://stackoverflow.com/questions/27930481/how-to-build-openmpi-with-homebrew-and-gcc-4-9).
We do *not* support `clang` due to conflicts with the Silo dependency.

```shell
export MFC_GCC_VER=13
export CC=gcc-$MFC_GCC_VER
export CXX=g++-$MFC_GCC_VER
export FC=gfortran-$MFC_GCC_VER
```

**Close the open editor and terminal window**. Open a **new terminal** window before executing the commands below.

```shell
brew install wget python cmake gcc@$MFC_GCC_VER mpich
brew install coreutils python cmake fftw hdf5 gcc open-mpi
```

They will download the dependencies MFC requires to build itself.

</details>

<details>
<summary><h3>Docker</h3></summary>

Docker is a lightweight, cross-platform, and performant alternative to Virtual Machines (VMs).
We build a Docker Image that contains the packages required to build and run MFC on your local machine.

First, install Docker and Git:
- Windows: [Docker](https://docs.docker.com/get-docker/) + [Git](https://git-scm.com/downloads).
- macOS: `brew install git docker` (requires [Homebrew](https://brew.sh/)).
- Other systems:
```shell
sudo apt install git docker # Debian / Ubuntu via Aptitude
sudo pacman -S git docker # Arch Linux via Pacman
```

Once Docker and Git are installed on your system, clone MFC with

```shell
git clone https://github.com/MFlowCode/MFC
cd MFC
```

To fetch the prebuilt Docker image and enter an interactive bash session with the
recommended settings applied, run

```shell
./mfc.sh docker # If on \*nix/macOS
.\mfc.bat docker # If on Windows
```

We automatically mount and configure the proper permissions for you to access your local copy of MFC, available at `~/MFC`.
You will be logged in as the `me` user with root permissions.

:warning: The state of your container is entirely transient, except for the MFC mount.
Thus, any modification outside of `~/MFC` should be considered permanently lost upon session exit.

</details>

## Building MFC

MFC can be built with support for various (compile-time) features:
Expand Down
37 changes: 0 additions & 37 deletions mfc.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@echo off

if "%1" == "docker" goto label_docker

goto label_windows

:label_windows
Expand Down Expand Up @@ -54,38 +52,3 @@ if %main_py_err% neq 0 (
exit /b %main_py_err%

:label_windows_after


:label_docker
where docker >nul 2>nul
if %errorlevel% neq 0 (
echo.
echo ^[mfc.bat^] You must have Docker installed.
echo Please install Docker and try again.
exit /b 1
)


echo ^[mfc.bat^] Fetching image...
docker pull henryleberre/mfc
if %errorlevel% neq 0 (
echo.
echo ^[mfc.bat^] Docker: Failed to fetch image.
echo Pleasure ensure docker is running.
exit /b 1
)

echo ^[mfc.bat^] Starting container...
docker run --interactive --tty --rm ^
--mount type=bind,source="%cd%",target=/home/me/MFC ^
henryleberre/mfc

if %errorlevel% neq 0 (
echo.
echo Docker: Fatal container runtime error.
exit /b 1
)


exit /b 0
:label_docker_after
2 changes: 0 additions & 2 deletions mfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ elif [ "$1" '==' "format" ]; then
. "$(pwd)/toolchain/bootstrap/python.sh"

shift; . "$(pwd)/toolchain/bootstrap/format.sh" $@; exit 0
elif [ "$1" '==' "docker" ]; then
shift; . "$(pwd)/toolchain/bootstrap/docker.sh" $@; exit 0
elif [ "$1" '==' "venv" ]; then
shift; . "$(pwd)/toolchain/bootstrap/python.sh" $@; return
elif [ "$1" '==' "clean" ]; then
Expand Down
12 changes: 0 additions & 12 deletions src/simulation/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ contains
integer :: iostatus
!! Integer to check iostat of file read

CHARACTER(len=511) :: CRAY_ACC_MODULE

character(len=1000) :: line

! Namelist of the global parameters which may be specified by user
Expand Down Expand Up @@ -200,16 +198,6 @@ contains
call s_mpi_abort(trim(file_path)//' is missing. Exiting ...')
end if

#ifdef _CRAYFTN
#ifdef MFC_OpenACC
call get_environment_variable("CRAY_ACC_MODULE", CRAY_ACC_MODULE)

if (CRAY_ACC_MODULE == "") then
call s_mpi_abort("CRAY_ACC_MODULE is not set. Exiting...")
end if
#endif
#endif

end subroutine s_read_input_file

!> The goal of this procedure is to verify that each of the
Expand Down
24 changes: 0 additions & 24 deletions toolchain/Dockerfile

This file was deleted.

Loading

0 comments on commit 2d1de77

Please sign in to comment.