Installation - vivi235711/gamer GitHub Wiki
-
Set up the machine configuration file
Please see Machine Configuration File.
-
Set your machine configuration file as default
sh tool/config/set_settings.sh --local --machine=your_machine
Note
If you want to set the default machine configuration file for all GAMER copies under your user account, use the --global option instead of --local.
You can still override the global setting for individual GAMER copies using the --local option.
Furthermore, you can override the default setting by passing the --machine=your_machine when executing configure.py.
-
Go to the source directory
cd src -
Generate
Makefileusing the Python scriptconfigure.pyTo get the
Makefile, please execute the following command:python configure.py [--your_arguments]
[--your_arguments]represent the options that should align with your simulation requirements. Refer to Option List for a complete list of available options.For example, the following command sets the FFTW method to
FFTW2and enables gravity and GPU.python configure.py --fftw=FFTW2 --gravity=true --gpu=true
Tip
An example script generate_make.sh to generate Makefile can be found in each test problem folder,
e.g., example/test_problem/Hydro/AcousticWave/generate_make.sh.
-
Compile the code
make clean make
If the compilation succeeds, you will see the following message
Compiling GAMER --> Successful!
and get an executable
gamer, which will be automatically copied to../bin/gamer.
Tip
To reduce the compilation time, you can perform a parallel
compilation by make -j N, where N is the number of compilation
jobs to run in parallel. For example, the following command will
invoke 4 compilation jobs simultaneously:
make -j 4However, please consult the documentation of your system to avoid violating the usage policy.
-
[Optional] Autocompletion of
configure.pySince there are many options in GAMER, we have introduced an autocomplete feature for
configure.py. You can enable this feature by the following steps:-
Update the shebang of
configure.py(if needed)For example, replace
#!/usr/bin/python3with the path to your preferred Python interpreter.Example at the top of configure.py
#!/usr/bin/python3 """ User guides of this script are provided in the following link.
https://github.com/gamer-project/gamer/wiki/Installation """
-
Copy the autocomplete shell script to
${HOME}/.config/gamer(~/.config/gamer/)mkdir -p ~/.config/gamer cp tool/config/config_autocomplete.sh ~/.config/gamer/
-
Update
~/.bashrcto load the autocomplete scriptPlease add the following line to
~/.bashrc:source ~/.config/gamer/config_autocomplete.sh
-
Note
The config_autocomplete.sh script registers autocomplete for three commands: python, python3, and ./configure.py..
If you want to add more commands, simply append them at the bottom of the script.
- Reload
~/.bashrcto enable the autocomplete featuresource ~/.bashrc
Now, try to type ./configure.py and then press <tab> multiple times!