Skip to content

Commit 78ff9c6

Browse files
committed
Merge remote-tracking branch 'upstream/master' into openmp_cce
2 parents 7ae0a65 + 9f40b5e commit 78ff9c6

File tree

6 files changed

+79
-29
lines changed

6 files changed

+79
-29
lines changed

.github/workflows/homebrew.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ jobs:
251251
cp $(brew --prefix mfc)/examples/1D_sodshocktube/case.py "$TESTDIR/"
252252
253253
echo "Running with $(sysctl -n hw.ncpu) processors..."
254-
# Use absolute path since mfc wrapper creates its own tmpdir
255-
mfc run "$TESTDIR/case.py" -j $(sysctl -n hw.ncpu)
254+
# Use absolute path and shorthand syntax (mfc auto-detects and prepends 'run')
255+
mfc "$TESTDIR/case.py" -j $(sysctl -n hw.ncpu)
256256
257257
echo "Test case completed successfully!"
258258

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
<img src="https://img.shields.io/badge/Codespaces-Open%20in%201%20click-2ea44f?logo=github" />
3737
</a>
3838
<a href="https://github.com/MFlowCode/MFC/releases">
39-
<img src="https://img.shields.io/github/v/release/MFlowCode/MFC?display_name=release&sort=semver" />
39+
<img src="https://img.shields.io/github/v/release/MFlowCode/MFC?display_name=release" />
4040
</a>
41+
<a href="https://github.com/MFlowCode/homebrew-mfc">
42+
<img src="https://img.shields.io/badge/homebrew-mflowcode%2Fmfc%2Fmfc-brown?logo=homebrew&style=flat" />
43+
</a>
4144
</p>
4245

4346
<p align="center">
4447
<a href="https://star-history.com/#MFlowCode/MFC&Date">
45-
<img src="https://api.star-history.com/svg?repos=MFlowCode/MFC&type=Date" alt="Star History Chart" width="600"/>
48+
<img src="https://api.star-history.com/svg?repos=MFlowCode/MFC&type=Date&theme=dark" alt="Star History Chart" width="600"/>
4649
</a>
4750
</p>
4851

@@ -59,9 +62,9 @@ MFC runs at exascale on the world's fastest supercomputers:
5962

6063
| Path | Command |
6164
| --- | --- |
62-
| **Codespaces** (fastest) | Click the "Codespaces" badge above to launch in 1 click |
63-
| **Homebrew (macOS)** | `brew install mflowcode/mfc/mfc && mfc run $(brew --prefix mfc)/examples/1D_sodshocktube/case.py -n 2` |
64-
| **Local build** | `./mfc.sh build -j $(nproc) && ./mfc.sh test -j $(nproc)` |
65+
| **Codespaces** (fastest) 💨 | Click the "Codespaces" badge above to launch in 1 click |
66+
| **Homebrew** (macOS) 🍺 | `brew install mflowcode/mfc/mfc && mfc $(brew --prefix mfc)/examples/1D_sodshocktube/case.py -n 2` |
67+
| **Local build** 💻 | `./mfc.sh build -j $(nproc) && ./mfc.sh test -j $(nproc)` |
6568

6669
**Welcome!**
6770
MFC simulates compressible multi-phase flows, [among other things](#what-else-can-this-thing-do).
@@ -127,6 +130,16 @@ And here is a high-amplitude acoustic wave reflecting and emerging through a cir
127130

128131
## Getting started
129132

133+
You can navigate [to this webpage](https://mflowcode.github.io/documentation/md_getting-started.html) to get you get started using MFC on your local machine, cluster, or supercomputer!
134+
It's rather straightforward.
135+
Some examples are below.
136+
137+
### Codespaces and Containers
138+
139+
<a href="https://github.com/codespaces/new?hide_repo_select=true&ref=master&repo=MFlowCode%2FMFC">
140+
<img src="https://img.shields.io/badge/Codespaces-Open%20in%201%20click-2ea44f?logo=github" />
141+
</a>
142+
130143
For a _very_ quick start, open a GitHub Codespace to load a pre-configured Docker container and familiarize yourself with MFC commands.
131144
Click <kbd> <> Code</kbd> (green button at top right) → <kbd>Codespaces</kbd> (right tab) → <kbd>+</kbd> (create a codespace).
132145

@@ -135,18 +148,19 @@ Click <kbd> <> Code</kbd> (green button at top right) → <kbd>Codespaces</kbd>
135148
> Don't conduct any critical work here!
136149
> To learn more, please see [how Docker & Containers work](https://mflowcode.github.io/documentation/md_docker.html).
137150
138-
You can navigate [to this webpage](https://mflowcode.github.io/documentation/md_getting-started.html) to get you get started using MFC on your local machine, cluster, or supercomputer!
139-
It's rather straightforward.
140-
141151
### macOS quick start (Homebrew)
142152

153+
<a href="https://github.com/MFlowCode/homebrew-mfc">
154+
<img src="https://img.shields.io/badge/homebrew-mflowcode%2Fmfc%2Fmfc-brown?logo=homebrew&style=flat" />
155+
</a>
156+
143157
Install the prebuilt package and run an example:
144158

145159
```bash
146160
brew install mflowcode/mfc/mfc
147161
mkdir -p ~/mfc_quickstart && cd ~/mfc_quickstart
148162
cp $(brew --prefix mfc)/examples/1D_sodshocktube/case.py .
149-
mfc run case.py -n 2
163+
mfc case.py -n 2
150164
```
151165

152166
Use `-n X` to select the number of MPI processes. For developer commands (`build`, `test`, etc.), clone the repo and use `./mfc.sh`.

docs/documentation/getting-started.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ Run a quick example:
2323
mkdir -p ~/mfc_quickstart && cd ~/mfc_quickstart
2424
cp $(brew --prefix mfc)/examples/1D_sodshocktube/case.py .
2525
# Use -n X to choose the number of MPI processes
26-
mfc run case.py -n 2
26+
mfc case.py -n 2
2727
```
2828

2929
Notes:
30-
- The Homebrew wrapper supports only `mfc run ...`. Developer commands like `build`, `test`, `clean` are available when you clone the repo and use `./mfc.sh`.
30+
- The Homebrew package uses a simplified syntax: just `mfc <case.py>` to run cases.
31+
- Developer commands like `build`, `test`, `clean` are available when you clone the repo and use `./mfc.sh`.
3132
- The package bundles a Python venv and prebuilt binaries; no additional setup is required.
3233
- Examples are installed at `$(brew --prefix mfc)/examples/`.
3334

docs/documentation/running.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ several supercomputer clusters, both interactively and through batch submission.
1313
If you installed MFC via Homebrew, run cases with the `mfc` wrapper:
1414

1515
```bash
16-
mfc run <path/to/case.py> -n 2
16+
mfc <path/to/case.py> -n 2
1717
```
1818

1919
- Use `-n X` to control the number of MPI processes (ranks).
20-
- Only the `run` command is supported in the Homebrew wrapper.
20+
- The Homebrew package uses a simplified syntax: just `mfc <case.py>` to run cases.
2121
- To use developer commands (`build`, `test`, `clean`, etc.), clone the repository and use `./mfc.sh`.
2222
- The wrapper passes through runtime flags like `-t pre_process simulation`, `-n`, and others; it always runs with preinstalled binaries.
2323
- Examples live at `$(brew --prefix mfc)/examples/`.

packaging/homebrew/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Run the 1D Sod shock tube example:
1515
```bash
1616
mkdir -p ~/mfc_example && cd ~/mfc_example
1717
cp $(brew --prefix mfc)/examples/1D_sodshocktube/case.py .
18-
mfc run case.py -n 2
18+
mfc case.py -n 2
1919
```
2020

2121
## What's Included
@@ -28,12 +28,12 @@ mfc run case.py -n 2
2828
## Usage
2929

3030
```bash
31-
mfc run <case.py> -n <processes>
31+
mfc <case.py> -n <processes>
3232
```
3333

3434
Use `-n X` to set the number of MPI processes.
3535

36-
**Note**: The Homebrew wrapper supports only `mfc run`. For developer commands (`build`, `test`, `clean`, etc.), [clone the repository](https://github.com/MFlowCode/MFC) and use `./mfc.sh`.
36+
**Note**: The Homebrew wrapper supports only running cases. For developer commands (`build`, `test`, `clean`, etc.), [clone the repository](https://github.com/MFlowCode/MFC) and use `./mfc.sh`.
3737

3838
## Documentation
3939

packaging/homebrew/mfc.rb

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,17 @@ def install
9494
fi
9595
done
9696
97-
SUBCMD="${ARGS[0]-}"
98-
9997
# Friendly help and guardrails
100-
if [[ ${#ARGS[@]} -eq 0 ]] || [[ "${SUBCMD}" == "--help" ]] || [[ "${SUBCMD}" == "-h" ]]; then
98+
if [[ ${#ARGS[@]} -eq 0 ]] || [[ "${ARGS[0]-}" == "--help" ]] || [[ "${ARGS[0]-}" == "-h" ]]; then
10199
cat <<'HHELP'
102100
MFC (Homebrew) #{version}
103101
104102
Usage:
105-
mfc run <case.py> [options]
103+
mfc <case.py> [options]
106104
107105
Examples:
108-
mfc run case.py -j 1
106+
mfc case.py -n 2
107+
mfc examples/1D_sodshocktube/case.py -n 2 -t pre_process simulation
109108
110109
Notes:
111110
- This Homebrew wrapper uses prebuilt binaries and a preinstalled venv.
@@ -115,12 +114,48 @@ def install
115114
exit 0
116115
fi
117116
118-
if [[ "${SUBCMD}" != "run" ]]; then
119-
echo "mfc (Homebrew): only 'run' is supported in the Homebrew package."
120-
echo "Use 'mfc run <case.py>' or clone the repository for developer commands."
117+
# Handle --version flag
118+
if [[ "${ARGS[0]-}" == "--version" ]] || [[ "${ARGS[0]-}" == "-v" ]]; then
119+
echo "MFC (Homebrew) #{version}"
120+
exit 0
121+
fi
122+
123+
# Find first non-flag argument
124+
first_nonflag=""
125+
for arg in "${ARGS[@]}"; do
126+
if [[ "$arg" != -* ]]; then
127+
first_nonflag="$arg"
128+
break
129+
fi
130+
done
131+
132+
# Check if no case file provided
133+
if [[ -z "${first_nonflag}" ]]; then
134+
echo "mfc (Homebrew): missing case file."
135+
echo "Usage: mfc <case.py> [options]"
136+
echo "Example: mfc case.py -n 2"
137+
exit 2
138+
fi
139+
140+
# Check if user accidentally used 'mfc run' syntax (even with flags before it)
141+
if [[ "${first_nonflag}" == "run" ]]; then
142+
echo "mfc (Homebrew): The 'run' command is not needed."
143+
echo "Usage: mfc <case.py> [options]"
144+
echo "Example: mfc case.py -n 2"
121145
exit 2
122146
fi
123147
148+
# Require a readable Python file (not a directory)
149+
if [[ ! "${first_nonflag}" =~ .py$ ]] || [[ ! -f "${first_nonflag}" ]]; then
150+
echo "mfc (Homebrew): first argument must be a readable Python case file."
151+
echo "Given: ${first_nonflag}"
152+
echo "Usage: mfc <case.py> [options]"
153+
exit 2
154+
fi
155+
156+
# Always prepend "run" since this wrapper only supports running cases
157+
ARGS=("run" "${ARGS[@]}")
158+
124159
# Create a temporary working directory (Cellar is read-only)
125160
TMPDIR="$(mktemp -d)"
126161
trap 'rm -rf "${TMPDIR}"' EXIT
@@ -218,17 +253,17 @@ def caveats
218253
MFC has been installed successfully!
219254
220255
To run a case:
221-
mfc run <case.py>
256+
mfc <case.py> [options]
222257
223258
Pre-built binaries are also available directly:
224259
pre_process, simulation, post_process
225260
226261
Examples are available in:
227262
#{prefix}/examples
228263
229-
Example:
264+
Quick start:
230265
cp #{prefix}/examples/1D_sodshocktube/case.py .
231-
mfc run case.py
266+
mfc case.py -n 2
232267
233268
Note: Cantera 3.1.0 is pre-installed in the MFC virtual environment.
234269
EOS

0 commit comments

Comments
 (0)