@roflmaostc As I mentioned in this closed PR https://github.com/PtyLab/PtyLab.py/pull/61, after one manually sets attribute params.gpuSwitch, the availability of cupy and cuda should perhaps be tested. I have implemented these things in this small PR and I'll summarize the 4 conditions that are implemented :
If user sets params.gpuSwitch=True when cupy/cuda is available, nothing is done because params.gpuSwitch is already set to True.
If user sets params.gpuSwitch=False, when cupy/cuda is not available, nothing is done because params.gpuSwitch is already set to False.
If user sets params.gpuSwitch=False, when cupy/cuda is available, this is allowed with a small message: "Disabling GPU switch. If this is unwanted, please set self.gpuSwitch = True"
If user sets params.gpuSwitch=True when cupy/cuda is not available, an attribute error is thrown suggesting that the user cannot set this switch to True.
@roflmaostc As I mentioned in this closed PR https://github.com/PtyLab/PtyLab.py/pull/61, after one manually sets attribute
params.gpuSwitch
, the availability of cupy and cuda should perhaps be tested. I have implemented these things in this small PR and I'll summarize the 4 conditions that are implemented :params.gpuSwitch=True
when cupy/cuda is available, nothing is done becauseparams.gpuSwitch
is already set to True.params.gpuSwitch=False
, when cupy/cuda is not available, nothing is done becauseparams.gpuSwitch
is already set to False.params.gpuSwitch=False
, when cupy/cuda is available, this is allowed with a small message: "Disabling GPU switch. If this is unwanted, please setself.gpuSwitch = True
"params.gpuSwitch=True
when cupy/cuda is not available, an attribute error is thrown suggesting that the user cannot set this switch to True.