UCBerkeleySETI / hyperseti

A SETI / technosignature search code to find intelligent life beyond Earth
https://hyperseti.readthedocs.io
11 stars 4 forks source link

Need a way to select a particular GPU device ID #50

Closed texadactyl closed 2 years ago

texadactyl commented 2 years ago

Cloning what turbo_seti does would be fine.

In find_doppler/kernels/__init__.py the gpu_id is a parameter. Not exactly the same but roughly:

self.xp = importlib.import_module("cupy")
self.np = importlib.import_module("numpy")
self.xp.cuda.Device(self.gpu_id).use()
texadactyl commented 2 years ago

Source to modify:

texadactyl commented 2 years ago

New utils.py function:

def attach_gpu_device(new_id):
    """ On demand, switch to GPU ID new_id.
    """
    try:
        cp.cuda.Device(new_id).use()
        logger.info("attach_gpu_device: Using device ID ({})".format(new_id))
    except:
        cur_id = cp.cuda.Device().id
        logger.error("attach_gpu_device: cp.cuda.Device({}).use() FAILED!".format(new_id))
        logger.warning("attach_gpu_device: Will continue to use current device ID ({})".format(cur_id))