Skip to content

Commit d8e80e0

Browse files
committed
Merge branch 'main' into fpm
2 parents a223558 + 7dc402b commit d8e80e0

File tree

7 files changed

+509
-384
lines changed

7 files changed

+509
-384
lines changed

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.f90 text
7+
*.py text
8+
*.md text
9+
*.toml text
10+
*.yaml text
11+
Dockerfile* text
12+
13+
# Denote all files that are truly binary and should not be modified.
14+
*.sif binary

Dockerfile_tau

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+

NR_Fano_dan_env.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ dependencies:
88
- ifx_linux-64
99
- mpi4py
1010
- fpm
11+
- ford
12+
- graphviz
1113
- lmfit
1214
- ipykernel
1315
- matplotlib

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,25 @@ With `fpm` releases more recent than 0.12.0, one can replace `flang-new` with `f
1010

1111
|Vendor| Version(s) | Build/Test Command |
1212
|------|-----------------|--------------------------------------------------------------|
13-
|GNU | 14.3.0, 15.2.0 | `fpm test --compiler gfortran --profile release --flag "-march=native -fopenmp -ftree-parallelize-loops=4"` |
14-
| | 13.4.0 | `fpm test --compiler gfortran --profile release --flag "-march=native -fopenmp -ftree-parallelize-loops=4 -ffree-line-length-none"` |
13+
|GNU | 14.3.0, 15.2.0 | `fpm test --compiler gfortran --profile release --flag "-cpp -march=native -fopenmp -ftree-parallelize-loops=4"` |
14+
| | 13.4.0 | `fpm test --compiler gfortran --profile release --flag "-cpp -march=native -fopenmp -ftree-parallelize-loops=4 -ffree-line-length-none"` |
1515
|Intel | 2025.2.1 | `FOR_COARRAY_NUM_IMAGES=1 fpm test --compiler ifx --flag "-fpp -O3 -coarray" --profile release` |
16-
|LLVM | 20-22 | `fpm test --compiler flang-new --profile release --flag -O3` |
17-
| | 19 | `fpm test --compiler flang-new --profile release --flag "-O3 -mmlir -allow-assumed-rank"` |
16+
|LLVM | 20-22 | `fpm test --compiler flang-new --profile release --flag "-cpp -O3"` |
17+
| | 19 | `fpm test --compiler flang-new --profile release --flag "-cpp -O3 -mmlir -allow-assumed-rank"` |
1818
|NAG | 7.2, Build 7235 | `fpm test --compiler nagfor --flag "-fpp -O4"` |
1919

2020
**Caveat:** In the case of LLVM 19-20, the above commands succeed for testing band_distribution's Julienne dependency.
2121
A future pull request could test band_distribution itself with LLVM 19-20 via GitHub Actions.
2222

23+
### Preprocessor macros
24+
* Add `-DPREFER_DO_CONCURRENT` in the `--flag` argument to switch from array statements or `do` loops to `do concurrent`
25+
26+
### Experimental parallelization
27+
To multithread `do concurrent` on CPUs with LLVM `flang` 21 or later, try the following:
28+
```
29+
fpm test --compiler flang-new --profile release --flag "-O3 -cpp -DPREFER_DO_CONCURRENT -fopenmp -fdo-concurrent-to-openmp=host"
30+
```
31+
2332
# Testing the python calls
2433
This code builds a library that may be called within python (this is the original intent of the code). To test the python calls, run
2534

0 commit comments

Comments
 (0)