<commit_before>"""
The package for scikits.cuda initialization

Global variables: initSuccess
providing CUBLAS handle: cublas_handle
"""

gpu_initialized = False
gpu_device = None
gpu_context = None
MPI_enabled = False

try:
    from mpi4py import MPI
    MPI_enabled = True
except:
    pass

try:
    if MPI_enabled and MPI.COMM_WORLD.size>1:
        from .parallel import get_id_within_node
        gpuid = get_id_within_node()
        import pycuda.driver
        pycuda.driver.init()
        if gpuid>=pycuda.driver.Device.count():
            print '['+MPI.Get_processor_name()+'] more processes than the GPU numbers!'
            MPI.COMM_WORLD.Abort()
            raise
        gpu_device = pycuda.driver.Device(gpuid)
        gpu_context = gpu_device.make_context()
        gpu_initialized = True
    else:
        import pycuda.autoinit
        gpu_initialized = True
except:
    pass

try:
    from scikits.cuda import cublas
    import scikits.cuda.linalg as culinalg
    culinalg.init()
    cublas_handle = cublas.cublasCreate()
except:
    pass

def closeGPU():
    if gpu_context is not None:
        gpu_context.detach()<commit_msg>fix the problem starting multiple process with limited number of GPUs<commit_after>"""
The package for scikits.cuda initialization

Global variables: initSuccess
providing CUBLAS handle: cublas_handle
"""

gpu_initialized = False
gpu_device = None
gpu_context = None
MPI_enabled = False

try:
    from mpi4py import MPI
    MPI_enabled = True
except:
    pass

try:
    if MPI_enabled and MPI.COMM_WORLD.size>1:
        from .parallel import get_id_within_node
        gpuid = get_id_within_node()
        import pycuda.driver
        pycuda.driver.init()
        if gpuid>=pycuda.driver.Device.count():
            print '['+MPI.Get_processor_name()+'] more processes than the GPU numbers!'
            #MPI.COMM_WORLD.Abort()
            raise
        gpu_device = pycuda.driver.Device(gpuid)
        gpu_context = gpu_device.make_context()
        gpu_initialized = True
    else:
        import pycuda.autoinit
        gpu_initialized = True
except:
    pass

try:
    from scikits.cuda import cublas
    import scikits.cuda.linalg as culinalg
    culinalg.init()
    cublas_handle = cublas.cublasCreate()
except:
    pass

def closeGPU():
    if gpu_context is not None:
        gpu_context.detach()
{'fraction_non_alphanumeric': 0.07698851552530837, 'fraction_numerical': 0.0017014036580178648, 'mean_word_length': 2.8119935170178283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7278651', 'n_tokens_mistral': 781, 'n_tokens_neox': 766, 'n_words': 191}