Changeset 744 for codes/icosagcm


Ignore:
Timestamp:
10/03/18 17:58:55 (6 years ago)
Author:
dubos
Message:

devel : make_icosa option for mixed precision

Location:
codes/icosagcm/devel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/devel/Python/src/setup.py

    r694 r744  
    22from distutils.extension import Extension 
    33from Cython.Build import cythonize 
     4 
     5from ctypes import cdll, c_bool 
     6libicosa = cdll.LoadLibrary('libicosa.so') 
     7mixed_prec=c_bool.in_dll(libicosa, 'mixed_precision').value 
     8 
     9if mixed_prec: 
     10    extra_flags=["-DCPP_MIXED_PREC"] 
     11else: 
     12    extra_flags=None 
     13 
    414setup(  name = "DYNAMICO kernels for unstructured mesh", 
    515        ext_modules = cythonize([ 
    616            Extension("cxios",["cxios.pyx"],libraries=["xios"]), 
    7             Extension("unstructured",["unstructured.pyx"],libraries=["icosa","xios"]) 
    8             ]) 
     17            Extension("unstructured",["unstructured.pyx"],libraries=["icosa","xios"], extra_compile_args=extra_flags) 
     18            ], compile_time_env={'CPP_MIXED_PREC': mixed_prec} ) 
    919        ) 
  • codes/icosagcm/devel/make_icosa

    r743 r744  
    4444 -physics lmdz_generic     : use LMDZ generic physics (planets) 
    4545 -external_physics         : allows external physics 
     46 -mixed_prec               : compiles unstructured dynamics in single precision (float32) 
    4647fin 
    4748          exit;; 
     
    8687          external_physics="TRUE" ; shift ;; 
    8788 
     89      "-mixed_prec") 
     90          mixed_prec="TRUE" ; shift ;; 
    8891      *) 
    8992          code="$1" ; shift ;; 
     
    183186fi 
    184187 
     188if [[ "$mixed_prec" == "TRUE" ]] 
     189then 
     190  CPP_KEY="$CPP_KEY CPP_MIXED_PREC" 
     191fi 
     192 
    185193if [[ "$no_io_defined" == "FALSE" ]] 
    186194then  
  • codes/icosagcm/devel/src/unstructured/data_unstructured.F90

    r700 r744  
    1313       caldyn_vert_variant=caldyn_vert_cons, nb_threads=0, nb_stage=0 
    1414  LOGICAL(C_BOOL), BIND(C) :: hydrostatic=.TRUE., debug_hevi_solver=.TRUE. 
     15 
     16#ifdef CPP_MIXED_PREC 
     17  LOGICAL(C_BOOL), BIND(C) :: mixed_precision=.TRUE. 
     18#else 
     19  LOGICAL(C_BOOL), BIND(C) :: mixed_precision=.FALSE. 
     20#endif 
    1521 
    1622  INDEX, BIND(C) :: llm, nqdyn, edge_num, primal_num, dual_num, & 
  • codes/icosagcm/devel/src/unstructured/unstructured.h90

    r688 r744  
    1 #undef PREC_DOUBLE 
    2  
    31#define DBL REAL(C_DOUBLE) 
    42#define FLT REAL(C_FLOAT) 
    53#define TIME DBL 
    64 
    7 #ifdef PREC_DOUBLE 
     5#ifdef CPP_MIXED_PREC 
     6#define NUM FLT 
     7#define MPI_NUM MPI_REAL4 
     8#else 
    89#define NUM DBL 
    910#define MPI_NUM MPI_REAL8 
    10 #else 
    11 #define NUM FLT 
    12 #define MPI_NUM MPI_REAL4 
    1311#endif 
    1412 
Note: See TracChangeset for help on using the changeset viewer.