I start off by logging into the mfix website, navigating to the MFIX-Exa download page and clicking the Download button to download the tarball.
edit: I guess I can’t post more than 3 times in a row so this is going to be a long one…
Now, I open a terminal and unpack the tarball following the command on the Download page:
cd ~/Downloads
tar -xzvf mfix-23-12-tar.gz
I go into the mfix
directory and copy the build directory. Incredibly unnecessary, but that’s just what I do.
cd mfix/
cp -r exec exec.serial
cd exec.serial
Next I use the vi
editor (which I always forget how terrible default vi
is that’s shipped with ubuntu so when I say vi
I’m actually using vim.tiny
) to edit the GNUmakefile
. I’m just going to do the most basic build without MPI. So I set
USE_MPI = FALSE
DEBUG = FALSE
Then I try to make
, knowing full well it’s not going to make. It doesn’t, saying
Command 'make' not found, but can be installed with:
sudo apt install make
because I don’t have GNU make. But it gives me to command to install it. So I do,
sudo apt install make
But this gives me an error I don’t know:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package make is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'make' has no installation candidate
So I googled “ubuntu install make” to find a stackexchange with the answer:
sudo apt-get update
sudo apt-get -y install make
Oh. Right. update
first. I always forget that…
Ok. So I update and install GNU make and try to make clean && make
again but now it errors out with the message:
./subprojects/amrex/Tools/GNUMake/Make.defs:29: *** USE_DPCPP has been deprecated. Use USE_SYCL instead.
/bin/sh: 1: git: not found
Loading ../subprojects/amrex/Tools/GNUMake/comps/gnu.mak...
/bin/sh: 1: g++: not found
expr: syntax error: unexpected argument ‘8’
../subprojects/amrex/Tools/GNUMake/comps/gnu.mak:49: *** GCC < 8 not supported. Stop.
Looks like I have a few problems, but first the gcc version is too old. Let’s check it.
gcc --version
Command 'gcc' not found, but can be installed with:
sudo apt install gcc
Oh. Right. Ubuntu isn’t shipped with gcc by default. But look, it says what to do to install it right there. So I
sudo apt install gcc
and install gcc.
Now I try to make clean && make
again but I still get similar errors:
./subprojects/amrex/Tools/GNUMake/Make.defs:29: *** USE_DPCPP has been deprecated. Use USE_SYCL instead.
/bin/sh: 1: git: not found
Loading ../subprojects/amrex/Tools/GNUMake/comps/gnu.mak...
/bin/sh: 1: g++: not found
expr: syntax error: unexpected argument ‘8’
../subprojects/amrex/Tools/GNUMake/comps/gnu.mak:49: *** GCC < 8 not supported. Stop.
It looks like it’s going to need some help finding the compiler. But it also looks like it needs git,
which is a bit surprising because I thought we packaged the necessary subprojects… anyway, so I google “ubuntu install git” and
sudo apt install git-all
and install git.
Now I try to build again, make clean && make
and it’s still complaining that
../subprojects/amrex/Tools/GNUMake/comps/gnu.mak:49: *** GCC < 8 not supported. Stop.
even though a gcc --version
shows
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Oh. Right. I didn’t install a c++
compiler too. Duh. Check g++ --version
:
command 'g++' not found, but can be installed with:
sudo apt install g++
Again, I just follow the prompt,
sudo apt install g++
and install the GNU c++ compiler.
Ok! Now let’s try make clean && make
again. It starts to build. Slowly. . So I’m going to go do the dishes and be back in a little bit…
Failed again. This time an error building AMReX,
make: gfortran: No such file or directory
make: *** [../subprojects/amrex/Tools/GNUMake/Make.rules:329: tmp_build_dir/o/3d.gnu.EXE/AMReX_fort_mod.o] Error 127
Again, I’m missing a compiler. This time the GNU fortran compiler. I could install it, but MFIX-Exa has no fortran in it, so we don’t even need to build AMReX with fortran. I’ve never suppressed fortran with gmake so I pull up the amrex documentation and find the needed command, BL_NO_FORT=TRUE
, and add it to the GNUmakefile
and try to make clean && make
again. For some reason, make doesn’t like that command at all. I also tried DBL_NO_FORT=TRUE
and NO_FORT=TRUE
without success. I have no idea. Note to self, don’t be lazy and install cmake next time. (With cmake -DAMReX_FORTRAN=NO
disables fortran.) So I
sudo apt install gfortran
and try to make clean && make
again.
I’m going to crack a beer while this decrepit old machine struggles to build.
At the end of my beer and the end if my build, the bottom of the screen finally says,
SUCCESS
Let’s test it.
mkdir test && cd test
cp ../../benchmarks/05-cyl-fluidbed/Size0001/inputs ./test/
ln -s ../mfix3d.gnu.ex mfix
./mfix inputs
You should get a lot of screen output. If you want to see it, better to pipe it to a screen file. But it should start with (something like):
Initializing AMReX (152fdac6aa4c)...
AMReX (152fdac6aa4c) initialized
MFIX git describe: 23.12
AMReX-Hydro git hash: f24f4a6f00b93d79e9772100e620d219be7787cb
Number of levels: 1
and end with (something like):
Time spent in main (after init) 7.505165299
Time spent in main 8.187476383
AMReX (152fdac6aa4c) finalized
Voilà. You’ve run your first MFIX-Exa simulation.