1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-04 05:03:58 +01:00

adapt generator for flexible default precisions

This commit is contained in:
q-posev 2021-05-18 11:47:46 +02:00
parent 047153b7c1
commit 07725b2a0a

View File

@ -281,18 +281,24 @@ for fname in files_funcs_dsets:
templine2 = templine1 templine2 = templine1
if params['dtype'] == 'double': if params['dtype'] == 'double':
h5_dtype = 'double' h5_dtype = 'double'
f_dtype_default= 'real(8)'
f_dtype_double = 'real(8)' f_dtype_double = 'real(8)'
f_dtype_single = 'real(4)' f_dtype_single = 'real(4)'
c_dtype_default= 'double'
c_dtype_double = 'double' c_dtype_double = 'double'
c_dtype_single = 'float' c_dtype_single = 'float'
default_prec = '64'
elif params['dtype'] == 'int64_t': elif params['dtype'] == 'int64_t':
h5_dtype = 'int64' h5_dtype = 'int64'
f_dtype_default= 'integer(4)'
f_dtype_double = 'integer(8)' f_dtype_double = 'integer(8)'
f_dtype_single = 'integer(4)' f_dtype_single = 'integer(4)'
c_dtype_default= 'int32_t'
c_dtype_double = 'int64_t' c_dtype_double = 'int64_t'
c_dtype_single = 'int32_t' c_dtype_single = 'int32_t'
default_prec = '32'
templine1 = templine2.replace('$group_dset_dtype_double$', c_dtype_double) templine1 = templine2.replace('$group_dset_dtype_double$', c_dtype_double)
templine2 = templine1.replace('$group_dset_dtype_single$', c_dtype_single) templine2 = templine1.replace('$group_dset_dtype_single$', c_dtype_single)
@ -303,6 +309,12 @@ for fname in files_funcs_dsets:
templine1 = templine2.replace('$group_dset_f_dtype_double$', f_dtype_double) templine1 = templine2.replace('$group_dset_f_dtype_double$', f_dtype_double)
templine2 = templine1.replace('$group_dset_f_dtype_single$', f_dtype_single) templine2 = templine1.replace('$group_dset_f_dtype_single$', f_dtype_single)
templine1 = templine2.replace('$group_dset_f_dtype_default$', f_dtype_default)
templine2 = templine1.replace('$group_dset_dtype_default$', c_dtype_default)
templine1 = templine2.replace('$default_prec$', default_prec)
templine2 = templine1
templine1 = templine2.replace('$group_dset_rank$', str(params['rank'])) templine1 = templine2.replace('$group_dset_rank$', str(params['rank']))
templine2 = templine1 templine2 = templine1