-
Notifications
You must be signed in to change notification settings - Fork 4
Fix installation #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mlee03
wants to merge
10
commits into
NOAA-GFDL:main
Choose a base branch
from
mlee03:fix_install
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Fix installation #11
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
953c458
fix install
4866151
readme start
1ec7599
more readme
9bfd759
more readme
d7ca8a3
readme
52bf187
readme
c5bd5c5
readme
3b6f536
by to with
78c2a6d
include untracked file
5d70362
update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| global-include cLIBFMS/lib/libcFMS.* | ||
| graft pyfms/lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,46 @@ | ||
| # fms2py | ||
| # **`fms2py`** | ||
|
|
||
| ## **Installation** | ||
| pyFMS requires a compiled `cFMS` library and the pyFMS repository contains | ||
| cFMS as a submodule. If `cFMS` is not installed on the user's | ||
| local system, the library can be installed with | ||
|
|
||
| ``` | ||
| 1. git clone --recursive https://github.com/NOAA-GFDL/pyFMS.git | ||
| 2. cd pyFMS | ||
| 3. emacs ./compile.py (see Section compile.py) | ||
| 4. python ./compile.py | ||
| ``` | ||
|
|
||
| The script `compile.py` will first compile and install the FMS library (which is | ||
| a submodule in cFMS) to `pyfms/lib/FMS`. Then, compile.py will compile the cFMS library | ||
| linking to FMS in `pyfms/lib/FMS`. cFMS will be installed to `pyfms/lib/cFMS`. | ||
|
|
||
| Upon `import pyfms`, pyFMS will automatically load the cFMS library | ||
| in `pyfms/lib/cFMS`. If the cFMS library does not exist, or if users wish to load a | ||
| diferent instance of cFMS, the following should be set in the program before invoking | ||
| any pyFMS methods: | ||
|
|
||
| ``` | ||
| import pyfms | ||
| pyfms.cfms.init(libpath=path_to_cfms/libcFMS.so) | ||
| ``` | ||
|
|
||
| ## compile.py | ||
| To compile cFMS with the script `compile.py`, users will need to specify the following | ||
| fields: | ||
|
|
||
| 1. Fortran and C compilers, for example, as shown below: | ||
|
|
||
| ``` | ||
| FC = "mpif90" | ||
| CC = "mpicc" | ||
| ``` | ||
|
|
||
| 2. Path to the libyaml and netCDF installations, for example, as shown below: | ||
|
|
||
| ``` | ||
| yaml = "/opt/libyaml/0.2.5/GNU/14.2.0/" | ||
| netcdf = "/opt/netcdf/4.9.3/GNU/14.2.0/" | ||
| ``` | ||
Submodule cFMS
updated
16 files
| +13 −0 | .gitignore | |
| +8 −2 | Makefile.am | |
| +106 −0 | c_horiz_interp/c_horiz_interp.F90 | |
| +30 −0 | c_horiz_interp/c_horiz_interp.h | |
| +32 −0 | c_horiz_interp/include/c_get_interp.fh | |
| +49 −20 | c_horiz_interp/include/c_get_interp.inc | |
| +7 −11 | c_horiz_interp/include/c_horiz_interp_new.inc | |
| +16 −9 | configure.ac | |
| +4 −0 | libcFMS/Makefile.am | |
| +2 −2 | test_cfms/c_data_override/Makefile.am | |
| +3 −3 | test_cfms/c_diag_manager/Makefile.am | |
| +2 −2 | test_cfms/c_fms/Makefile.am | |
| +2 −2 | test_cfms/c_fms_utils/Makefile.am | |
| +2 −2 | test_cfms/c_grid_utils/Makefile.am | |
| +4 −4 | test_cfms/c_horiz_interp/Makefile.am | |
| +244 −14 | test_cfms/c_horiz_interp/test_horiz_interp_new.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| import os | ||
| import subprocess | ||
|
|
||
|
|
||
| # path to the installed yaml library | ||
| yaml = "/opt/libyaml/0.2.5/GNU/14.2.0/" | ||
|
|
||
| # path to the installed netcdf library | ||
| netcdf = "/opt/netcdf/4.9.3/GNU/14.2.0/" | ||
|
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not ideal as they are hard-coded for a specific versions and a specific machine. I know this is addressed in the Readme. |
||
|
|
||
| # Fortran compiler | ||
| FC = "mpif90" | ||
|
|
||
| # C compiler | ||
| CC = "mpicc" | ||
|
|
||
| # default Fortran compiler flags | ||
| FMS_FCFLAGS = f"-I{yaml}/include -I{netcdf}/include -fPIC" | ||
|
|
||
| # default C compiler flags | ||
| FMS_CFLAGS = f"-I{yaml}/include -I{netcdf}/include -fPIC" | ||
|
|
||
| # library flags | ||
| FMS_LDFLAGS = f"-L{yaml}/lib -L{netcdf}/lib -lnetcdf" | ||
|
|
||
| cFMS_FCFLAGS = "-fPIC" | ||
| cFMS_CFLAGS = "-fPIC" | ||
| cFMS_LDFLAGS = "" | ||
|
|
||
| # current directory | ||
| currdir = os.path.dirname(__file__) | ||
|
|
||
| # absolute path to cFMS submodule | ||
| cFMS = f"{currdir}/cFMS" | ||
|
|
||
| # absolute path to FMS submodule | ||
| FMS = f"{cFMS}/FMS" | ||
|
|
||
| # absolue path to install libraries | ||
| cFMS_install = f"{currdir}/pyfms/lib/cFMS" | ||
| FMS_install = f"{currdir}/pyfms/lib/FMS" | ||
|
|
||
|
|
||
| def compile_FMS(): | ||
|
|
||
| """ | ||
| Install FMS to FMS_install | ||
| """ | ||
|
|
||
| currdir = os.path.dirname(__file__) | ||
| os.chdir(FMS) | ||
|
|
||
| subprocess.run(["autoreconf", "-iv"]) | ||
| subprocess.run( | ||
| [ | ||
| "./configure", | ||
| "--enable-portable-kinds", | ||
| "--with-yaml", | ||
| f"FC={FC}", | ||
| f"CC={CC}", | ||
| f"FCFLAGS={FMS_FCFLAGS}", | ||
| f"CFLAGS={FMS_CFLAGS}", | ||
| f"LDFLAGS={FMS_LDFLAGS}", | ||
| f"--prefix={FMS_install}", | ||
| ] | ||
| ) | ||
| subprocess.run(["make", "install"]) | ||
|
|
||
| os.chdir(currdir) | ||
|
|
||
|
|
||
| def compile_cFMS(): | ||
|
|
||
| """ | ||
| Install cFMS to cFMS_install | ||
| """ | ||
| currdir = os.path.dirname(__file__) | ||
| os.chdir(cFMS) | ||
|
|
||
| subprocess.run(["autoreconf", "-iv"]) | ||
| subprocess.run( | ||
| [ | ||
| "./configure", | ||
| f"--with-fms={FMS_install}", | ||
| f"FC={FC}", | ||
| f"CC={CC}", | ||
| f"FCFLAGS={cFMS_FCFLAGS}", | ||
| f"CFLAGS={cFMS_CFLAGS}", | ||
| f"LDFLAGS={cFMS_LDFLAGS}", | ||
| f"--prefix={cFMS_install}", | ||
| ] | ||
| ) | ||
| subprocess.run(["make", "install"]) | ||
|
|
||
| os.chdir(currdir) | ||
|
|
||
|
|
||
| # compile | ||
| compile_FMS() | ||
| compile_cFMS() | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires an MPI library be accessible. You'll need to mention that as well. Is there any chance this could become an issue if mpi4py and the MPI used here are different flavors?