Changeset 663 for codes/icosagcm/devel
- Timestamp:
- 01/19/18 23:43:11 (6 years ago)
- Location:
- codes/icosagcm/devel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/dynamico/__init__.py
r618 r663 1 # import NetCDF before other modules 2 import netCDF4 1 # import openmp before NetCDF4 numpy because it uses numpy hence MKL and messes up OMP_NUM_PROCS 2 import sys 3 if 'numpy' in sys.modules: 4 raise ImportError('Module dynamico must be imported before NetCDF/numpy because numpy may mess up OpenMP') 5 import libs 6 libs.libicosa.dynamico_show_openmp() -
codes/icosagcm/devel/Python/dynamico/wrap.py
r615 r663 38 38 39 39 class SharedLib: 40 def __init__(self,vardict, name,check_args=True, prefix_so='',prefix_py=''):40 def __init__(self,vardict,lib,check_args=True, prefix_so='',prefix_py=''): 41 41 self.vardict, self.check_args = vardict, check_args 42 42 self.prefix_so, self.prefix_py = prefix_so, prefix_py 43 self.lib= cdll.LoadLibrary(name)43 self.lib=lib 44 44 self.vars={} 45 45 def import_funs(self,prototypes,prefix=''): -
codes/icosagcm/devel/Python/src/unstructured.pyx
r643 r663 1 1 import time 2 2 import math 3 import numpy as np4 cimport numpy as np5 3 import dynamico.wrap as wrap 4 from dynamico.libs import libicosa 5 6 6 from ctypes import c_void_p, c_int, c_double, c_bool 7 7 8 8 #from libc.time cimport time as ctime, time_t 9 9 from numpy cimport ndarray 10 cimport numpy as np 10 11 11 12 #------------- direct Cython interface to DYNAMICO routines -------------# … … 39 40 40 41 try: 41 kernels = wrap.SharedLib(vars(ker), 'libicosa.so', check_args=check_args)42 kernels = wrap.SharedLib(vars(ker), libicosa, check_args=check_args) 42 43 setvar, setvars, getvar, getvars = kernels.setvar, kernels.setvars, kernels.getvar, kernels.getvars 43 44 except OSError: … … 291 292 # i.e. index[start:end] with start=vtxdist[cell], end=vtxdist[cell+1] lists the edges of cell 'cell' 292 293 294 import numpy as np 295 293 296 def list_stencil(degree, stencil, cond=lambda x:True): 294 297 for i in range(degree.size): -
codes/icosagcm/devel/Python/src/xios.pyx
r630 r663 1 from dynamico.libs import libxios 2 import dynamico.wrap as wrap 1 3 import numpy as np 2 import dynamico.wrap as wrap 4 3 5 from ctypes import c_int, c_double, c_bool, c_void_p, c_char_p, byref, POINTER, Structure 4 6 c_void_pp=POINTER(c_void_p) # used in prototype … … 35 37 36 38 lib=wrap.Struct() 37 cxios = wrap.SharedLib(vars(lib), "libxios.so", prefix_so='cxios_')39 cxios = wrap.SharedLib(vars(lib), libxios, prefix_so='cxios_') 38 40 39 41 class Duration(Structure): -
codes/icosagcm/devel/Python/test/py/test_xios.py
r631 r663 1 #print 'import dynamico' 2 #import dynamico 3 print 'import dynamico.unstructured' 4 import dynamico.unstructured as unst 5 print 'import dynamico.xios' 6 import dynamico.xios as xios 7 print 'Done.' 8 from dynamico.meshes import MPAS_Mesh as Mesh, radian 9 1 10 from mpi4py import MPI 2 11 comm = MPI.COMM_WORLD … … 5 14 6 15 import numpy as np 7 print 'import dynamico.unstructured'8 import dynamico.unstructured as unst9 print 'import dynamico.xios'10 import dynamico.xios as xios11 print 'Done.'12 from dynamico.meshes import MPAS_Mesh as Mesh, radian13 16 14 17 def boundaries(degree,points,lon,lat): -
codes/icosagcm/devel/src/unstructured/data_unstructured.F90
r658 r663 188 188 PRINT *,' ... Done.' 189 189 IF(nb_threads==0) nb_threads=OMP_GET_MAX_THREADS() 190 PRINT *,'OpenMP : max_threads, num_procs, nb_threads', OMP_GET_MAX_THREADS(), omp_get_num_procs(), nb_threads 191 190 PRINT *,'OpenMP : max_threads, num_procs, nb_threads', OMP_GET_MAX_THREADS(), OMP_GET_NUM_PROCS(), nb_threads 192 191 END SUBROUTINE init_metric 192 ! 193 SUBROUTINE show_openmp() BINDC(show_openmp) 194 PRINT *,'OpenMP : max_threads, num_procs', OMP_GET_MAX_THREADS(), OMP_GET_NUM_PROCS() 195 END SUBROUTINE show_openmp 193 196 ! 194 197 SUBROUTINE init_params() BINDC(init_params)
Note: See TracChangeset
for help on using the changeset viewer.