h2lib 0.0.4__cp38-cp38-win_amd64.whl → 13.0.404__cp38-cp38-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- h2lib/HAWC2Lib.dll +0 -0
- h2lib/_h2lib.py +28 -0
- {h2lib-0.0.4.data/purelib/h2lib → h2lib}/dll_wrapper.py +255 -236
- h2lib/h2lib_signatures.py +100 -0
- {h2lib-0.0.4.dist-info → h2lib-13.0.404.dist-info}/METADATA +4 -4
- h2lib-13.0.404.dist-info/RECORD +10 -0
- {h2lib-0.0.4.dist-info → h2lib-13.0.404.dist-info}/WHEEL +1 -1
- h2lib-0.0.4.data/purelib/h2lib/TestLib.dll +0 -0
- h2lib-0.0.4.data/purelib/h2lib/_h2lib.py +0 -13
- h2lib-0.0.4.dist-info/RECORD +0 -9
- {h2lib-0.0.4.data/purelib/h2lib → h2lib}/__init__.py +0 -0
- {h2lib-0.0.4.data/purelib/h2lib → h2lib}/calc.py +0 -0
- {h2lib-0.0.4.dist-info → h2lib-13.0.404.dist-info}/top_level.txt +0 -0
h2lib/HAWC2Lib.dll
ADDED
Binary file
|
h2lib/_h2lib.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import numpy as np
|
2
|
+
from h2lib.dll_wrapper import DLLWrapper
|
3
|
+
import os
|
4
|
+
|
5
|
+
from h2lib.h2lib_signatures import H2LibSignatures
|
6
|
+
in_use = None
|
7
|
+
|
8
|
+
|
9
|
+
class H2Lib(H2LibSignatures, DLLWrapper):
|
10
|
+
def __init__(self, filename=None):
|
11
|
+
if filename is None:
|
12
|
+
if os.name == 'nt':
|
13
|
+
filename = os.path.dirname(__file__) + '/HAWC2Lib.dll'
|
14
|
+
else:
|
15
|
+
filename = os.path.dirname(__file__) + '/HAWC2Lib.so'
|
16
|
+
|
17
|
+
DLLWrapper.__init__(self, filename, cdecl=True)
|
18
|
+
|
19
|
+
def getState(self):
|
20
|
+
return H2LibSignatures.getState(self, restype=np.int32)
|
21
|
+
|
22
|
+
|
23
|
+
if __name__ == '__main__':
|
24
|
+
h2lib = H2Lib()
|
25
|
+
h2lib.echo_version()
|
26
|
+
(s,), res = h2lib.get_version("")
|
27
|
+
print("#" + s + "#")
|
28
|
+
print(h2lib.getSquare(3., restype=np.float64))
|
@@ -1,236 +1,255 @@
|
|
1
|
-
import numpy as np
|
2
|
-
from numpy.ctypeslib import ndpointer
|
3
|
-
import ctypes as ct
|
4
|
-
import _ctypes
|
5
|
-
|
6
|
-
import os
|
7
|
-
import ctypes
|
8
|
-
from _ctypes import POINTER
|
9
|
-
from ctypes import c_int, c_double, c_char, c_char_p, c_long
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
import
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
if
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
arg
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
1
|
+
import numpy as np
|
2
|
+
from numpy.ctypeslib import ndpointer
|
3
|
+
import ctypes as ct
|
4
|
+
import _ctypes
|
5
|
+
import platform
|
6
|
+
import os
|
7
|
+
import ctypes
|
8
|
+
from _ctypes import POINTER
|
9
|
+
from ctypes import c_int, c_double, c_char, c_char_p, c_long
|
10
|
+
import tempfile
|
11
|
+
import shutil
|
12
|
+
try:
|
13
|
+
from ctypes import windll
|
14
|
+
except ImportError:
|
15
|
+
pass
|
16
|
+
import sys
|
17
|
+
from pathlib import Path
|
18
|
+
import atexit
|
19
|
+
c_int_p = POINTER(ctypes.c_long)
|
20
|
+
c_double_p = POINTER(ctypes.c_double)
|
21
|
+
in_use = []
|
22
|
+
|
23
|
+
|
24
|
+
class DLLWrapper(object):
|
25
|
+
def __init__(self, filename, cdecl=True):
|
26
|
+
if filename in in_use:
|
27
|
+
self.temp_dir = tempfile.TemporaryDirectory()
|
28
|
+
tmp_filename = os.path.join(self.temp_dir.name, os.path.basename(filename))
|
29
|
+
shutil.copy(filename, tmp_filename)
|
30
|
+
filename = tmp_filename
|
31
|
+
else:
|
32
|
+
self.temp_dir = None
|
33
|
+
in_use.append(filename)
|
34
|
+
self.filename = str(filename)
|
35
|
+
self.cdecl = cdecl
|
36
|
+
self.open()
|
37
|
+
atexit.register(self.close)
|
38
|
+
|
39
|
+
@staticmethod
|
40
|
+
def find_dll(path, name):
|
41
|
+
p = Path(path)
|
42
|
+
|
43
|
+
# if sys.platform == "win32":
|
44
|
+
# prefixes = ['']
|
45
|
+
# if sys.maxsize > 2**32:
|
46
|
+
# suffixes = ['.dll', '_64.dll']
|
47
|
+
# else:
|
48
|
+
# suffixes = ['.dll']
|
49
|
+
# elif sys.platform == 'linux':
|
50
|
+
# prefixes = ['lib','']
|
51
|
+
# suffixes = ['.so']
|
52
|
+
# else:
|
53
|
+
# raise NotImplementedError()
|
54
|
+
|
55
|
+
dll_lst = []
|
56
|
+
file_patterns = ['*%s*.dll' % name, '*%s*.so' % name]
|
57
|
+
for fp in file_patterns:
|
58
|
+
dll_lst.extend(list(p.glob("**/" + fp)))
|
59
|
+
|
60
|
+
def use_first(dll_lst):
|
61
|
+
f = str(dll_lst[0])
|
62
|
+
print("Using ", os.path.abspath(f))
|
63
|
+
return DLLWrapper(f)
|
64
|
+
|
65
|
+
if len(dll_lst) == 1:
|
66
|
+
return use_first(dll_lst)
|
67
|
+
elif len(dll_lst) > 1:
|
68
|
+
# check if excluding dlls in hawc2-binary, i.e. "hawc2-<platform>" results in one dll
|
69
|
+
dll_lst2 = [d for d in dll_lst if not str(d).startswith('hawc2-')]
|
70
|
+
if len(dll_lst2) == 1:
|
71
|
+
return use_first(dll_lst2)
|
72
|
+
raise FileExistsError("Multiple dlls found:\n" + "\n".join([str(p) for p in dll_lst]))
|
73
|
+
else:
|
74
|
+
raise FileNotFoundError("No " + " or ".join(file_patterns) +
|
75
|
+
" files found in " + os.path.abspath(p.absolute()))
|
76
|
+
|
77
|
+
def open(self):
|
78
|
+
assert os.path.isfile(self.filename), os.path.abspath(self.filename)
|
79
|
+
if self.cdecl:
|
80
|
+
if tuple(map(int,platform.python_version().split('.'))) < (3,8):
|
81
|
+
self.lib = ct.CDLL(self.filename)
|
82
|
+
else:
|
83
|
+
self.lib = ct.CDLL(self.filename, winmode=ctypes.DEFAULT_MODE)
|
84
|
+
else:
|
85
|
+
self.lib = windll.LoadLibrary(self.filename)
|
86
|
+
|
87
|
+
def close(self):
|
88
|
+
if "FreeLibrary" in dir(_ctypes):
|
89
|
+
_ctypes.FreeLibrary(self.lib._handle)
|
90
|
+
else:
|
91
|
+
_ctypes.dlclose(self.lib._handle)
|
92
|
+
atexit.unregister(self.close)
|
93
|
+
in_use.remove(self.filename)
|
94
|
+
if self.temp_dir:
|
95
|
+
self.temp_dir.cleanup()
|
96
|
+
|
97
|
+
# def __enter__(self):
|
98
|
+
# self.open()
|
99
|
+
# return self
|
100
|
+
#
|
101
|
+
# def __exit__(self, type, value, traceback):
|
102
|
+
# self.close()
|
103
|
+
# return False
|
104
|
+
|
105
|
+
def __getattribute__(self, name):
|
106
|
+
try:
|
107
|
+
return object.__getattribute__(self, name)
|
108
|
+
except AttributeError:
|
109
|
+
if name == 'lib':
|
110
|
+
raise Exception("DLL not loaded. Run using: 'with dll: ...'")
|
111
|
+
return self.get_lib_function(name)
|
112
|
+
|
113
|
+
def get_lib_function(self, name):
|
114
|
+
try:
|
115
|
+
f = getattr(self.lib, name)
|
116
|
+
except AttributeError as e:
|
117
|
+
raise AttributeError("Attribute '%s' not found in dll ('%s')" % (name, self.filename))
|
118
|
+
|
119
|
+
def wrap(*args, **kwargs):
|
120
|
+
c_args = []
|
121
|
+
for arg in args:
|
122
|
+
if isinstance(arg, int):
|
123
|
+
c_args.append(c_int_p(c_int(arg)))
|
124
|
+
elif isinstance(arg, float):
|
125
|
+
c_args.append(c_double_p(c_double(arg)))
|
126
|
+
elif isinstance(arg, str):
|
127
|
+
c_args.append(c_char_p(arg.encode('cp1252')))
|
128
|
+
# c_args.append(c_int_p(c_int(len(arg))))
|
129
|
+
|
130
|
+
elif isinstance(arg, np.ndarray):
|
131
|
+
if arg.dtype == int:
|
132
|
+
c_args.append(arg.ctypes.data_as(c_int_p))
|
133
|
+
elif arg.dtype == np.float64:
|
134
|
+
c_args.append(arg.ctypes.data_as(c_double_p))
|
135
|
+
else:
|
136
|
+
raise NotImplementedError(arg.dtype)
|
137
|
+
|
138
|
+
else:
|
139
|
+
# raise NotImplementedError(arg.__class__.__name__)
|
140
|
+
c_args.append(arg)
|
141
|
+
if 'restype' in kwargs:
|
142
|
+
restype = kwargs['restype']
|
143
|
+
if hasattr(restype, 'dtype'):
|
144
|
+
restype = np.ctypeslib.as_ctypes_type(restype)
|
145
|
+
f.restype = restype
|
146
|
+
|
147
|
+
res = f(*c_args)
|
148
|
+
ret_args = []
|
149
|
+
for arg in args:
|
150
|
+
c_arg = c_args.pop(0)
|
151
|
+
if isinstance(arg, (int, float)):
|
152
|
+
ret_args.append(c_arg.contents.value)
|
153
|
+
elif isinstance(arg, (str)):
|
154
|
+
ret_args.append(c_arg.value.decode('cp1252'))
|
155
|
+
# c_args.pop(0)
|
156
|
+
elif isinstance(arg, np.ndarray):
|
157
|
+
ret_args.append(arg)
|
158
|
+
else:
|
159
|
+
raise NotImplementedError(arg.__class__.__name__)
|
160
|
+
return ret_args, res
|
161
|
+
return wrap
|
162
|
+
|
163
|
+
def version(self, function_name='get_version'):
|
164
|
+
try:
|
165
|
+
f = getattr(self.lib, function_name)
|
166
|
+
f.argtypes = [c_char_p, c_long]
|
167
|
+
s = "".ljust(255)
|
168
|
+
arg = c_char_p(s.encode('utf-8'))
|
169
|
+
f(arg, len(s))
|
170
|
+
return arg.value.decode().strip()
|
171
|
+
except AttributeError:
|
172
|
+
if function_name == 'get_version':
|
173
|
+
return self.version('version')
|
174
|
+
|
175
|
+
def getFileProperties(self):
|
176
|
+
if sys.platform != "win32":
|
177
|
+
raise OSError("Only supported for Windows")
|
178
|
+
import win32api
|
179
|
+
fname = self.filename
|
180
|
+
|
181
|
+
# ==============================================================================
|
182
|
+
"""
|
183
|
+
Read all properties of the given file return them as a dictionary.
|
184
|
+
"""
|
185
|
+
propNames = ('Comments', 'InternalName', 'ProductName',
|
186
|
+
'CompanyName', 'LegalCopyright', 'ProductVersion',
|
187
|
+
'FileDescription', 'LegalTrademarks', 'PrivateBuild',
|
188
|
+
'FileVersion', 'OriginalFilename', 'SpecialBuild')
|
189
|
+
|
190
|
+
props = {'FixedFileInfo': None, 'StringFileInfo': None, 'FileVersion': None}
|
191
|
+
|
192
|
+
try:
|
193
|
+
# backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc
|
194
|
+
fixedInfo = win32api.GetFileVersionInfo(fname, '\\')
|
195
|
+
props['FixedFileInfo'] = fixedInfo
|
196
|
+
props['FileVersion'] = "%d.%d.%d.%d" % (fixedInfo['FileVersionMS'] / 65536,
|
197
|
+
fixedInfo['FileVersionMS'] % 65536, fixedInfo['FileVersionLS'] / 65536,
|
198
|
+
fixedInfo['FileVersionLS'] % 65536)
|
199
|
+
|
200
|
+
# \VarFileInfo\Translation returns list of available (language, codepage)
|
201
|
+
# pairs that can be used to retreive string info. We are using only the first pair.
|
202
|
+
lang, codepage = win32api.GetFileVersionInfo(fname, '\\VarFileInfo\\Translation')[0]
|
203
|
+
|
204
|
+
# any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle
|
205
|
+
# two are language/codepage pair returned from above
|
206
|
+
|
207
|
+
strInfo = {}
|
208
|
+
for propName in propNames:
|
209
|
+
strInfoPath = u'\\StringFileInfo\\%04X%04X\\%s' % (lang, codepage, propName)
|
210
|
+
# print str_info
|
211
|
+
strInfo[propName] = win32api.GetFileVersionInfo(fname, strInfoPath)
|
212
|
+
|
213
|
+
props['StringFileInfo'] = strInfo
|
214
|
+
except BaseException:
|
215
|
+
pass
|
216
|
+
|
217
|
+
return props
|
218
|
+
|
219
|
+
|
220
|
+
class Type2DllWrapper(DLLWrapper):
|
221
|
+
def __init__(self, filename, dll_subroutine_init, dll_subroutine_update,
|
222
|
+
arraysizes_init, arraysizes_update,
|
223
|
+
init_array):
|
224
|
+
super().__init__(filename)
|
225
|
+
self.dll_subroutine_init = dll_subroutine_init
|
226
|
+
self.dll_subroutine_update = dll_subroutine_update
|
227
|
+
self.arraysizes_init = arraysizes_init
|
228
|
+
self.arraysizes_update = arraysizes_update
|
229
|
+
self.init_array = init_array
|
230
|
+
|
231
|
+
def open(self):
|
232
|
+
DLLWrapper.open(self)
|
233
|
+
self.init()
|
234
|
+
|
235
|
+
def call(self, name, array, n1, n2):
|
236
|
+
f = getattr(self.lib, name)
|
237
|
+
f.argtypes = [ndpointer(shape=n1, dtype=ct.c_double, flags='FORTRAN'),
|
238
|
+
ndpointer(shape=n2, dtype=ct.c_double, flags='FORTRAN')]
|
239
|
+
f.restype = None
|
240
|
+
|
241
|
+
pad_array = np.zeros(n1)
|
242
|
+
pad_array[:len(array)] = array
|
243
|
+
arg1 = np.array(pad_array, dtype=ct.c_double, order='F')
|
244
|
+
arg2 = np.zeros(n2, dtype=ct.c_double, order='F')
|
245
|
+
|
246
|
+
f(arg1, arg2)
|
247
|
+
return(arg2)
|
248
|
+
|
249
|
+
def init(self):
|
250
|
+
n1, n2 = self.arraysizes_init
|
251
|
+
return self.call(self.dll_subroutine_init, self.init_array, n1, n2)
|
252
|
+
|
253
|
+
def update(self, array):
|
254
|
+
n1, n2 = self.arraysizes_update
|
255
|
+
return self.call(self.dll_subroutine_update, array, n1, n2)
|
@@ -0,0 +1,100 @@
|
|
1
|
+
from h2lib.dll_wrapper import DLLWrapper
|
2
|
+
class H2LibSignatures():
|
3
|
+
def echo_version(self, ):
|
4
|
+
'''subroutine echo_version() bind(c, name='echo_version')
|
5
|
+
! end subroutine'''
|
6
|
+
return self.get_lib_function('echo_version')()
|
7
|
+
|
8
|
+
def getSquare(self, val, restype):
|
9
|
+
'''function getsquare(val) result(valsquared) bind(c, name='getsquare')
|
10
|
+
!dec$ attributes dllexport :: getsquare
|
11
|
+
use, intrinsic :: iso_fortran_env, only: rk => real64
|
12
|
+
real(rk), intent(in) :: val
|
13
|
+
real(rk) :: valsquared
|
14
|
+
valsquared = val ** 2
|
15
|
+
end function'''
|
16
|
+
return self.get_lib_function('getSquare')(val, restype=restype)
|
17
|
+
|
18
|
+
def getState(self, restype):
|
19
|
+
'''function getstate() result(val) bind(c, name='getstate')
|
20
|
+
!dec$ attributes dllexport :: getstate
|
21
|
+
integer :: val
|
22
|
+
val = state
|
23
|
+
end function'''
|
24
|
+
return self.get_lib_function('getState')(restype=restype)
|
25
|
+
|
26
|
+
def get_version(self, s):
|
27
|
+
'''subroutine get_version(s) bind(c, name='get_version')
|
28
|
+
use iso_c_binding
|
29
|
+
implicit none
|
30
|
+
character(kind=c_char, len=1), intent(inout) :: s(255)
|
31
|
+
end subroutine'''
|
32
|
+
return self.get_lib_function('get_version')(s)
|
33
|
+
|
34
|
+
def setState(self, val):
|
35
|
+
'''subroutine setstate(val) bind(c, name='setstate')
|
36
|
+
!dec$ attributes dllexport :: setstate
|
37
|
+
integer, intent(in) :: val
|
38
|
+
state = val
|
39
|
+
end subroutine'''
|
40
|
+
return self.get_lib_function('setState')(val)
|
41
|
+
|
42
|
+
def sqr2(self, val):
|
43
|
+
'''subroutine sqr2(val) bind(c, name='sqr2')
|
44
|
+
!dec$ attributes dllexport :: sqr2
|
45
|
+
integer, intent(inout) :: val
|
46
|
+
val = val ** 2
|
47
|
+
end subroutine'''
|
48
|
+
return self.get_lib_function('sqr2')(val)
|
49
|
+
|
50
|
+
def test_hdf5(self, ):
|
51
|
+
'''subroutine test_hdf5() bind(c, name='test_hdf5')
|
52
|
+
!dec$ attributes dllexport :: test_hdf5
|
53
|
+
use hdf5
|
54
|
+
use iso_c_binding
|
55
|
+
|
56
|
+
integer :: hdferr ! error flag
|
57
|
+
character(9) :: filename = 'test.hdf5'
|
58
|
+
integer(hid_t) :: file_id ! file identifier
|
59
|
+
integer(hid_t) :: h5_create_file,h5_open_file ! file identifier
|
60
|
+
type(c_ptr) :: x
|
61
|
+
|
62
|
+
print *, "test hdf5"
|
63
|
+
print *, "system:", c_sizeof(x) * 8, 'bit'
|
64
|
+
|
65
|
+
print *, "create file"
|
66
|
+
call h5open_f(hdferr)
|
67
|
+
call h5fcreate_f(filename, h5f_acc_trunc_f, file_id, hdferr) !h5f_acc_trunc_f overwrite existing file
|
68
|
+
h5_create_file = file_id
|
69
|
+
|
70
|
+
print *, "open file"
|
71
|
+
call h5fopen_f(filename, h5f_acc_rdwr_f, file_id, hdferr)
|
72
|
+
h5_open_file = file_id
|
73
|
+
|
74
|
+
print *, "close file"
|
75
|
+
call h5fclose_f(file_id, hdferr)
|
76
|
+
call h5close_f(hdferr)
|
77
|
+
|
78
|
+
print *, "test succeeded"
|
79
|
+
end subroutine'''
|
80
|
+
return self.get_lib_function('test_hdf5')()
|
81
|
+
|
82
|
+
def test_mkl(self, ):
|
83
|
+
'''subroutine test_mkl() bind(c, name='test_mkl')
|
84
|
+
!dec$ attributes dllexport :: test_mkl
|
85
|
+
use mymkl
|
86
|
+
implicit none
|
87
|
+
|
88
|
+
! variables
|
89
|
+
|
90
|
+
real(8),dimension(3)::t3, tt3
|
91
|
+
real(8),dimension(3,3)::t33
|
92
|
+
|
93
|
+
! body of test_mkl
|
94
|
+
print *, 'hello world'
|
95
|
+
|
96
|
+
|
97
|
+
call dgemv('n',3,3,1.d0,t33,3,t3,1,0.d0,tt3,1)
|
98
|
+
print *, tt3
|
99
|
+
end subroutine'''
|
100
|
+
return self.get_lib_function('test_mkl')()
|
@@ -1,14 +1,14 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: h2lib
|
3
|
-
Version:
|
4
|
-
Summary: Python interface to HAWC2
|
3
|
+
Version: 13.0.404
|
4
|
+
Summary: Python interface to HAWC2 (13.0.4+5-g5e498aa)
|
5
5
|
Download-URL:
|
6
6
|
Author: S.G.Horcas and N.G.Ramos
|
7
7
|
Author-email:
|
8
8
|
Maintainer:
|
9
9
|
Maintainer-email:
|
10
|
-
Requires-Dist: intel-fortran-rt ==2021.3.0
|
11
|
-
Requires-Dist: mkl ==2021.3.0
|
12
10
|
Requires-Dist: numpy
|
13
11
|
Requires-Dist: pytest
|
12
|
+
Requires-Dist: intel-fortran-rt ==2021.3.0
|
13
|
+
Requires-Dist: mkl ==2021.3.0
|
14
14
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
h2lib/HAWC2Lib.dll,sha256=Z_ZG24v0RfQSlGz7NUNsuUNklhy4uAJYHqewsWP4c1w,29047296
|
2
|
+
h2lib/__init__.py,sha256=v4RtCtR7Cfv-LSx-9tnLK0WSefKVjIKrGjfBVBhONzI,27
|
3
|
+
h2lib/_h2lib.py,sha256=GBSryoz1g_FuPMk3zIKjVBmzq5JpQgLn1x7OZJXkzwY,801
|
4
|
+
h2lib/calc.py,sha256=eqPH_ruyWpnXVJDH8jVjuV3u-Dh_MiwSlgEV-hjDM_w,448
|
5
|
+
h2lib/dll_wrapper.py,sha256=pe6WKgIX4eDwROPwZROFM63a5cdnNnz0E68W-1T5YaA,9712
|
6
|
+
h2lib/h2lib_signatures.py,sha256=Kz7UrEA7yNMUi5sy6R7wUdClhvLAKNecAjq10WpB55k,3214
|
7
|
+
h2lib-13.0.404.dist-info/METADATA,sha256=FA9xI0sBY2yeHasEod3UzQuT_BxSJwkEq49YOzEAEOg,333
|
8
|
+
h2lib-13.0.404.dist-info/WHEEL,sha256=KplWMgwSZbeAOumvxNxIrVbNPnn_LVzfBH7l38jDCVM,100
|
9
|
+
h2lib-13.0.404.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
|
10
|
+
h2lib-13.0.404.dist-info/RECORD,,
|
Binary file
|
@@ -1,13 +0,0 @@
|
|
1
|
-
from h2lib.dll_wrapper import DLLWrapper
|
2
|
-
import os
|
3
|
-
|
4
|
-
|
5
|
-
class H2Lib(DLLWrapper):
|
6
|
-
def __init__(self, filename=None):
|
7
|
-
if filename is None:
|
8
|
-
if os.name == 'nt':
|
9
|
-
filename = os.path.dirname(__file__) + '/TestLib.dll'
|
10
|
-
else:
|
11
|
-
filename = os.path.dirname(__file__) + '/TestLib.so'
|
12
|
-
|
13
|
-
DLLWrapper.__init__(self, filename, cdecl=True)
|
h2lib-0.0.4.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
h2lib-0.0.4.data/purelib/h2lib/TestLib.dll,sha256=iRgC1hyKxjIoAoh4FruOU0Q78Gplh9BgxNOII00_9Q8,2859008
|
2
|
-
h2lib-0.0.4.data/purelib/h2lib/__init__.py,sha256=v4RtCtR7Cfv-LSx-9tnLK0WSefKVjIKrGjfBVBhONzI,27
|
3
|
-
h2lib-0.0.4.data/purelib/h2lib/_h2lib.py,sha256=tapiHobRD2T7jZhizOHCW9uX2sGjkDWMa-Na9oIBcYE,417
|
4
|
-
h2lib-0.0.4.data/purelib/h2lib/calc.py,sha256=eqPH_ruyWpnXVJDH8jVjuV3u-Dh_MiwSlgEV-hjDM_w,448
|
5
|
-
h2lib-0.0.4.data/purelib/h2lib/dll_wrapper.py,sha256=KWbqOu42EtO2WeP8T6ne5aYOEszs9QoheaKDbYS8JAQ,8903
|
6
|
-
h2lib-0.0.4.dist-info/METADATA,sha256=hACt34y2BAVpm3ZM6meuatN9gy6trlEFq0kTtrZkCFQ,310
|
7
|
-
h2lib-0.0.4.dist-info/WHEEL,sha256=ubKCG5XSDI8ZG5iAwgsAU4yUktRq9BG9Pse4izScbq0,100
|
8
|
-
h2lib-0.0.4.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
|
9
|
-
h2lib-0.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|