|
| 1 | +# Use Ubuntu 22.04 as base image |
| 2 | +FROM gmao/llvm-flang |
| 3 | + |
| 4 | +# Set environment variables |
| 5 | +ENV DEBIAN_FRONTEND=noninteractive |
| 6 | + |
| 7 | +# Install necessary packages |
| 8 | +RUN apt-get update && apt-get install -y \ |
| 9 | + software-properties-common \ |
| 10 | + wget \ |
| 11 | + bzip2 \ |
| 12 | + libz-dev \ |
| 13 | + g++ \ |
| 14 | + ca-certificates \ |
| 15 | + curl \ |
| 16 | + git \ |
| 17 | + nano \ |
| 18 | + && apt-get clean \ |
| 19 | + && rm -rf /var/lib/apt/lists/* |
| 20 | + |
| 21 | +RUN add-apt-repository ppa:ubuntu-toolchain-r/test \ |
| 22 | + && apt-get install -y gfortran-14 |
| 23 | + |
| 24 | +# Set up working directory |
| 25 | +WORKDIR /packages |
| 26 | + |
| 27 | +# Install Anaconda |
| 28 | +RUN wget https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh -O /tmp/anaconda.sh \ |
| 29 | + && bash /tmp/anaconda.sh -b -p /opt/anaconda \ |
| 30 | + && rm /tmp/anaconda.sh |
| 31 | + |
| 32 | +# Add Anaconda to PATH |
| 33 | +ENV PATH="/opt/anaconda/bin:${PATH}" |
| 34 | + |
| 35 | +# Initialize conda for bash shell |
| 36 | +RUN echo ". /opt/anaconda/etc/profile.d/conda.sh" >> ~/.bash_profile |
| 37 | +RUN echo ". /opt/anaconda/etc/profile.d/conda.sh" >> ~/.bashrc |
| 38 | + |
| 39 | +# Copy environment.yaml file |
| 40 | +COPY NR_Fano_dan_env.yaml . |
| 41 | + |
| 42 | +# Create conda environment from the yaml file |
| 43 | +# this installs fpm and intel compiler |
| 44 | +RUN conda env create -f NR_Fano_dan_env.yaml |
| 45 | +RUN echo "conda activate NR_Fano" >> ~/.bash_profile |
| 46 | +RUN echo "conda activate NR_Fano" >> ~/.bashrc |
| 47 | + |
| 48 | +# Source - https://stackoverflow.com/a/39777387 |
| 49 | +# Posted by Ahmad Abdelghany, modified by community. See post 'Timeline' for change history |
| 50 | +# Retrieved 2025-11-09, License - CC BY-SA 4.0 |
| 51 | +# this command, together with putting conda activation in .bash_profile, means we have |
| 52 | +# enabled the conda environment for every command |
| 53 | +SHELL ["/bin/bash", "--login", "-c"] |
| 54 | + |
| 55 | +# Check out TAU |
| 56 | +RUN git clone https://github.com/UO-OACISS/tau2.git --depth=1 |
| 57 | + |
| 58 | +# Build TAU |
| 59 | +# From Nicholas Chaimov |
| 60 | +# -pthread to enable pthread |
| 61 | +# Don’t specify -mpi to build without MPI |
| 62 | +# Most builds of TAU should use bfd, unwind, dwarf, otf to support sampling and tracing |
| 63 | +#RUN cd tau2 \ |
| 64 | +# && ./configure -cc=gcc -c++=g++ -fortran=gfortran -bfd=download -unwind=download -dwarf=download -otf=download -pthread \ |
| 65 | +# && make -j install |
| 66 | + |
| 67 | + |
| 68 | +WORKDIR /app |
| 69 | + |
| 70 | +# Copy the fortran code over |
| 71 | +# first we build the expected directory structure |
| 72 | +# and then we copy files |
| 73 | +RUN mkdir /app/src |
| 74 | +RUN mkdir /app/test |
| 75 | + |
| 76 | +COPY src /app/src/ |
| 77 | +COPY test /app/test |
| 78 | +COPY fpm.toml /app/ |
| 79 | + |
| 80 | +# also copy over the python functions for testing |
| 81 | +RUN mkdir /app/python |
| 82 | +COPY python /app/python/ |
| 83 | +COPY *.py /app |
| 84 | + |
| 85 | +# Now compile the fortran code |
| 86 | +RUN fpm test --compiler flang-new --profile release --flag -O3 \ |
| 87 | + && fpm install --prefix=. --compiler flang-new --profile release --flag -O3 |
| 88 | + |
0 commit comments