diff --git a/GNUmakefile b/GNUmakefile index a015b7d50312eeb9fcdec21885800b4ee3adc057..cb95faf3fb9d8fd74af119e778f6482ec5a62fdb 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -62,12 +62,17 @@ BLOSC_CPPFLAGS := \ BASE_CPPFLAGS := $(BLOSC_CPPFLAGS) -I. -D__STDC_CONSTANT_MACROS +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + OPENMPFLAG=-fopenmp +endif + FEDIR = frontend -FE_CFLAGS := -g -fPIC -O3 -fopenmp -std=gnu99 +FE_CFLAGS := -g -fPIC -O3 $(OPENMPFLAG) -std=gnu99 FE_CPPFLAGS := $(BASE_CPPFLAGS) -Ithirdparty/sqlite -DGENERICIO_NO_MPI MPIDIR = mpi -MPI_CFLAGS := -g -O3 -fopenmp -std=gnu99 +MPI_CFLAGS := -g -O3 $(OPENMPFLAG) -std=gnu99 MPI_CPPFLAGS := $(BASE_CPPFLAGS) $(FEDIR): diff --git a/python/genericio.py b/python/genericio.py index c9685e6ff97f159180c96b42b2b0b92ad4773580..afbe437fc9f8f14122a6ca99dfaa02e9bbfa511f 100644 --- a/python/genericio.py +++ b/python/genericio.py @@ -37,9 +37,10 @@ # # ***************************************************************************** +from __future__ import print_function import numpy as np import ctypes as ct -import os +import os,sys #Define where the library is and load it _path = os.path.dirname(__file__) @@ -71,14 +72,17 @@ libpygio.inspect_gio.restype=None libpygio.inspect_gio.argtypes=[ct.c_char_p] def gio_read(file_name,var_name): + if sys.version_info[0] == 3: + file_name = bytes(file_name,'ascii') + var_name = bytes(var_name,'ascii') var_size = libpygio.get_elem_num(file_name) var_type = libpygio.get_variable_type(file_name,var_name) field_count = libpygio.get_variable_field_count(file_name,var_name) if(var_type==10): - print "Variable not found" + print("Variable not found") return elif(var_type==9): - print "variable type not known (not int32/int64/float/double)" + print("variable type not known (not int32/int64/float/double)") elif(var_type==0): #float result = np.ndarray((var_size,field_count),dtype=np.float32) @@ -101,10 +105,15 @@ def gio_read(file_name,var_name): return result def gio_has_variable(file_name,var_name): + if sys.version_info[0] == 3: + file_name=bytes(file_name,'ascii') + var_name=bytes(var_name,'ascii') var_size = libpygio.get_elem_num(file_name) var_type = libpygio.get_variable_type(file_name,var_name) return var_type!=10 def gio_inspect(file_name): + if sys.version_info[0] == 3: + file_name=bytes(file_name,'ascii') libpygio.inspect_gio(file_name)