Changeset 8b31efa in sasmodels for sasmodels/kernelcl.py


Ignore:
Timestamp:
Oct 15, 2018 1:27:14 PM (6 years ago)
Author:
pkienzle
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
508475a, d5ce7fa
Parents:
4de14584
Message:

document cuda device selection; fix cuda speed issue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernelcl.py

    rb0de252 r8b31efa  
    227227        self.context = None 
    228228        if 'SAS_OPENCL' in os.environ: 
    229             #Setting PYOPENCL_CTX as a SAS_OPENCL to create cl context 
    230             os.environ["PYOPENCL_CTX"] = os.environ["SAS_OPENCL"] 
     229            # Set the PyOpenCL environment variable PYOPENCL_CTX  
     230            # from SAS_OPENCL=driver:device.  Ignore the generic 
     231            # SAS_OPENCL=opencl, which is used to select the default  
     232            # OpenCL device.  Don't need to check for "none" or 
     233            # "cuda" since use_opencl() would return False if they 
     234            # were defined, and we wouldn't get here. 
     235            dev_str = os.environ["SAS_OPENCL"] 
     236            if dev_str and dev_str.lower() != "opencl": 
     237                os.environ["PYOPENCL_CTX"] = dev_str 
     238 
    231239        if 'PYOPENCL_CTX' in os.environ: 
    232240            self._create_some_context() 
     
    568576                current_time = time.clock() 
    569577                if current_time - last_nap > 0.5: 
    570                     time.sleep(0.05) 
     578                    time.sleep(0.001) 
    571579                    last_nap = current_time 
    572580        cl.enqueue_copy(self.queue, self.result, self.result_b) 
Note: See TracChangeset for help on using the changeset viewer.