Browse Source

Updated build scripts, manifest, requirements, install docs

lon0
Bill Ladwig 7 years ago
parent
commit
cff1c0e956
  1. 2
      MANIFEST.in
  2. 2
      build_scripts/gnu_omp.sh
  3. 12
      build_scripts/win_mingw_no_omp.bat
  4. 12
      build_scripts/win_mingw_omp.bat
  5. 12
      build_scripts/win_msvc_mingw_no_omp.bat
  6. 12
      build_scripts/win_msvc_mingw_omp.bat
  7. 58
      doc/source/installation.rst
  8. 3
      requirements.txt
  9. 9
      src/wrf/__init__.py

2
MANIFEST.in

@ -4,6 +4,8 @@ include requirements.txt
include fortran/*.f90 include fortran/*.f90
include fortran/*.pyf include fortran/*.pyf
include build_scripts/*.sh
include build_scripts/*.bat
include setup.py include setup.py
recursive-include doc/source * recursive-include doc/source *

2
build_scripts/gnu_omp.sh

@ -2,7 +2,7 @@
cd ../fortran cd ../fortran
gfortran -E ompgen.F90 -fopenmp -cpp -o omp.f90 gfortran -E ompgen.F90 -fopenmp -cpp -o omp.f90
f2py *.f90 -m _wrffortran -h wrffortran.pyf --overwrite-signature --no-wrap-functions f2py *.f90 -m _wrffortran -h wrffortran.pyf --overwrite-signature
cd .. cd ..
python setup.py clean --all python setup.py clean --all
python setup.py config_fc --f90flags="-mtune=generic -fopenmp" build_ext --libraries="gomp" build python setup.py config_fc --f90flags="-mtune=generic -fopenmp" build_ext --libraries="gomp" build

12
build_scripts/win_mingw_no_omp.bat

@ -1,13 +1,13 @@
cd ../fortran cd ../fortran
gfortran -E ompgen.F90 -cpp -o omp.f90 CALL gfortran -E ompgen.F90 -cpp -o omp.f90
REM Wildcards not working on Windows for some reason REM Wildcards not working on Windows for some reason
f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 CALL f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90
cd .. cd ..
python setup.py clean --all CALL python setup.py clean --all
%PROCESSOR_ARCHITECTURE% == AMD64 ( %PROCESSOR_ARCHITECTURE% == AMD64 (
python setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2" build --compiler=mingw32 --fcompiler=gnu95 CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2" build --compiler=mingw32 --fcompiler=gnu95
) else ( ) else (
python setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2 -mincoming-stack-boundary=2" build --compiler=mingw32 --fcompiler=gnu95 CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2 -mincoming-stack-boundary=2" build --compiler=mingw32 --fcompiler=gnu95
) )
python setup.py install --single-version-externally-managed --record=record.txt CALL python setup.py install --single-version-externally-managed --record=record.txt

12
build_scripts/win_mingw_omp.bat

@ -1,13 +1,13 @@
cd ../fortran cd ../fortran
gfortran -E ompgen.F90 -cpp -fopenmp -o omp.f90 CALL gfortran -E ompgen.F90 -cpp -fopenmp -o omp.f90
REM Wildcards not working on Windows for some reason REM Wildcards not working on Windows for some reason
f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 CALLf2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90
cd .. cd ..
python setup.py clean --all CALL python setup.py clean --all
%PROCESSOR_ARCHITECTURE% == AMD64 ( %PROCESSOR_ARCHITECTURE% == AMD64 (
python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp" build_ext --libraries="gomp" build --compiler=mingw32 --fcompiler=gnu95 CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp" build_ext --libraries="gomp" build --compiler=mingw32 --fcompiler=gnu95
) else ( ) else (
python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp -mincoming-stack-boundary=2" build_ext --libraries="gomp" build --compiler=mingw32 --fcompiler=gnu95 CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp -mincoming-stack-boundary=2" build_ext --libraries="gomp" build --compiler=mingw32 --fcompiler=gnu95
) )
python setup.py install --single-version-externally-managed --record=record.txt CALL python setup.py install --single-version-externally-managed --record=record.txt

12
build_scripts/win_msvc_mingw_no_omp.bat

@ -1,13 +1,13 @@
cd ../fortran cd ../fortran
gfortran -E ompgen.F90 -cpp -o omp.f90 CALL gfortran -E ompgen.F90 -cpp -o omp.f90
REM Wildcards not working on Windows for some reason REM Wildcards not working on Windows for some reason
f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 CALL f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90
cd .. cd ..
python setup.py clean --all CALL python setup.py clean --all
%PROCESSOR_ARCHITECTURE% == AMD64 %PROCESSOR_ARCHITECTURE% == AMD64
python setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2" build --compiler=msvc --fcompiler=gnu95 CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2" build --compiler=msvc --fcompiler=gnu95
) else ( ) else (
python setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2 -mincoming-stack-boundary=2" build --compiler=msvc --fcompiler=gnu95 CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -mfpmath=sse -msse2 -mincoming-stack-boundary=2" build --compiler=msvc --fcompiler=gnu95
) )
python setup.py install --single-version-externally-managed --record=record.txt CALL python setup.py install --single-version-externally-managed --record=record.txt

12
build_scripts/win_msvc_mingw_omp.bat

@ -1,13 +1,13 @@
cd ../fortran cd ../fortran
gfortran -E ompgen.F90 -cpp -fopenmp -o omp.f90 CALL gfortran -E ompgen.F90 -cpp -fopenmp -o omp.f90
REM Wildcards not working on Windows for some reason REM Wildcards not working on Windows for some reason
f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90 CALL f2py -m _wrffortran -h wrffortran.pyf --overwrite-signature wrf_constants.f90 wrf_testfunc.f90 wrf_user.f90 rip_cape.f90 wrf_cloud_fracf.f90 wrf_fctt.f90 wrf_user_dbz.f90 wrf_relhl.f90 calc_uh.f90 wrf_user_latlon_routines.f90 wrf_pvo.f90 eqthecalc.f90 wrf_rip_phys_routines.f90 wrf_pw.f90 wrf_vinterp.f90 wrf_wind.f90 omp.f90
cd .. cd ..
python setup.py clean --all CALL python setup.py clean --all
%PROCESSOR_ARCHITECTURE% == AMD64 ( %PROCESSOR_ARCHITECTURE% == AMD64 (
python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95 CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95
) else ( ) else (
python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp -mincoming-stack-boundary=2" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95 CALL python setup.py config_fc --f90flags="-O2 -mtune=generic -fopenmp -mincoming-stack-boundary=2" build_ext --libraries="gomp" build --compiler=msvc --fcompiler=gnu95
) )
python setup.py install --single-version-externally-managed --record=record.txt CALL python setup.py install --single-version-externally-managed --record=record.txt

58
doc/source/installation.rst

@ -4,9 +4,10 @@ Installation
Required Dependencies Required Dependencies
---------------------- ----------------------
- Python 2.7, 3.4, or 3.5 - Python 2.7, 3.4, or 3.5+
- numpy (1.9 or later) - numpy (1.11 or later; 1.14 required to build on Windows)
- wrapt (1.10 or later) - wrapt (1.10 or later)
- setuptools (38.0 or later)
Highly Recommended Packages Highly Recommended Packages
@ -81,13 +82,52 @@ The source code is available via github:
https://github.com/NCAR/wrf-python https://github.com/NCAR/wrf-python
To install, change to the wrf-python directory and run:: Or PyPI:
https://pypi.python.org/pypi/wrf-python
To install, if you do not need OpenMP support, change your working directory
to the wrf-python source directory and run::
$ pip install . $ pip install .
Note that building on Win64 with Python 3.5+ and the mingw-64 compiler Beginning with wrf-python 1.1, OpenMP is supported, but preprocessing the
is very difficult, due to incompatibilities with the runtime libraries and ompgen.F90 file is required, which also requires running f2py to
lack of support from numpy's distutils. Improved support for these build the .pyf file. To simplify this process, you can use the build scripts in
configurations, along with numpy distutils support, should take place this the *build_scripts* directory as a guide, or just call the script directly.
year. But for now, visual studio and the intel compiler may be required.
Otherwise, Python 2.7 or Python 3.4 is recommended. Below is a sample from a build script for GNU compiler with OpenMP enabled:
.. code-block:: none
cd ../fortran
gfortran -E ompgen.F90 -fopenmp -cpp -o omp.f90
f2py *.f90 -m _wrffortran -h wrffortran.pyf --overwrite-signature
cd ..
python setup.py clean --all
python setup.py config_fc --f90flags="-mtune=generic -fopenmp" build_ext --libraries="gomp" build
pip install .
Beginning with numpy 1.14, f2py extensions can now be built using the MSVC
compiler and mingw gfortran compiler. Numpy 1.14 is required to build
wrf-python for Python 3.5+.
.. note::
If you are building on a supercomputer and receiving linker related
errors (e.g. missing symbols, undefined references, etc), you probably
need to unset the LDFLAGS environment variable. System administrators on
supercomputing systems often define LDFLAGS for you so that you don't need
to worry about where libraries like NetCDF are installed. Unfortunately,
this can cause problems with the numpy.distutils build system. To fix,
using the build command from above::
$ unset LDFLAGS python setup.py config_fc --f90flags="-mtune=generic -fopenmp" build_ext --libraries="gomp" build

3
requirements.txt

@ -1,2 +1,3 @@
numpy>=1.10 numpy>=1.11
wrapt>=1.10 wrapt>=1.10
setuptools>=38.0

9
src/wrf/__init__.py

@ -4,12 +4,13 @@ import os
import pkg_resources import pkg_resources
# For gfortran+msvc combination, extra shared libraries may exist (stored by numpy.distutils) # For gfortran+msvc combination, extra shared libraries may exist (stored by numpy.distutils)
if os.name == 'nt': if os.name == "nt":
try: try:
req = pkg_resources.Requirement.parse('wrf-python') req = pkg_resources.Requirement.parse("wrf-python")
extra_dll_dir = pkg_resources.resource_filename(req, 'wrf-python/extra-dll') extra_dll_dir = pkg_resources.resource_filename(req,
"wrf-python/.libs")
if os.path.isdir(extra_dll_dir): if os.path.isdir(extra_dll_dir):
os.environ['PATH'] += os.pathsep + extra_dll_dir os.environ["PATH"] += os.pathsep + extra_dll_dir
except ImportError: except ImportError:
pass pass

Loading…
Cancel
Save