Changeset 00afc15 in sasmodels
- Timestamp:
- Nov 9, 2018 2:55:32 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3199b17
- Parents:
- 0be86aa
- Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernelcl.py
r0be86aa r00afc15 444 444 variants = ['Iq', 'Iqxy', 'Imagnetic'] 445 445 names = [generate.kernel_name(self.info, k) for k in variants] 446 handles = [getattr(program, k) for k in names]447 self._kernels = {k: v for k, v in zip(variants, handles)}446 functions = [getattr(program, k) for k in names] 447 self._kernels = {k: v for k, v in zip(variants, functions)} 448 448 # keep a handle to program so GC doesn't collect 449 449 self._program = program -
sasmodels/kernelcuda.py
r7126c04 r00afc15 63 63 import time 64 64 import re 65 import atexit 65 66 66 67 import numpy as np # type: ignore … … 138 139 return ENV 139 140 141 def free_context(): 142 global ENV 143 if ENV is not None: 144 ENV.release() 145 ENV = None 146 147 atexit.register(free_context) 148 140 149 def has_type(dtype): 141 150 # type: (np.dtype) -> bool … … 341 350 variants = ['Iq', 'Iqxy', 'Imagnetic'] 342 351 names = [generate.kernel_name(self.info, k) for k in variants] 343 handles = [program.get_function(k) for k in names]344 self._kernels = {k: v for k, v in zip(variants, kernels)}352 functions = [program.get_function(k) for k in names] 353 self._kernels = {k: v for k, v in zip(variants, functions)} 345 354 # keep a handle to program so GC doesn't collect 346 355 self._program = program 347 348 def release(self):349 # type: () -> None350 """351 Free the resources associated with the model.352 """353 if self.program is not None:354 self.program = None355 356 def __del__(self):357 # type: () -> None358 self.release()359 356 360 357 # TODO: check that we don't need a destructor for buffers which go out of scope … … 473 470 kernel_args = [ 474 471 np.uint32(self.q_input.nq), None, None, 475 details_b, values_b, self.q_input.q_b, self. result_b,472 details_b, values_b, self.q_input.q_b, self._result_b, 476 473 self._as_dtype(cutoff), 477 474 np.uint32(effective_radius_type), … … 487 484 stop = min(start + step, call_details.num_eval) 488 485 #print("queuing",start,stop) 489 args[1:3] = [np.int32(start), np.int32(stop)]490 kernel(* args, **grid)486 kernel_args[1:3] = [np.int32(start), np.int32(stop)] 487 kernel(*kernel_args, **grid) 491 488 if stop < call_details.num_eval: 492 489 sync() … … 497 494 last_nap = current_time 498 495 sync() 499 cuda.memcpy_dtoh(self.result, self. result_b)496 cuda.memcpy_dtoh(self.result, self._result_b) 500 497 #print("result", self.result) 501 498 -
sasmodels/model_test.py
r5024a56 r00afc15 167 167 # test using cuda if desired and available 168 168 if 'cuda' in loaders and use_cuda(): 169 test_name = "%s-cuda" %model_name169 test_name = "%s-cuda" % model_info.id 170 170 test_method_name = "test_%s_cuda" % model_info.id 171 171 # Using dtype=None so that the models that are only
Note: See TracChangeset
for help on using the changeset viewer.