rosalindfranklininstitute / RedLionfish

Apache License 2.0
28 stars 4 forks source link

how to choose a different device #18

Open joaomamede opened 6 months ago

joaomamede commented 6 months ago

The only way to choose a diferent device is to change this bit of the code right in the reikna.py?

        ocldevice = self.api.get_platforms()[0].get_devices()[0] #Get first device available
        logging.info(f"OCL device selected : {ocldevice}")

Basically if we want to setup parallel multi GPU or using the integrated GPU it's the only way to select the device?

ty for RedLionFish

perdigao1 commented 5 months ago

I just added an option to choose a preferred device by matching string. You can see an example in https://github.com/rosalindfranklininstitute/RedLionfish/blob/d3b94c166da167725a5840877bea491198739882/scripts/test_and_benchm.py#L130C1-L131C87

import RedLionfishDeconv.RLDeconv3DReiknaOCL as rlocl

rlocl.RL_CL_PLATFORM_PREFERENCE="intel" # sets to use intel CPU as openCL device
res_ocl_intel = rlocl.nonBlock_RLDeconvolutionReiknaOCL(data,datapsf, niter=niter)