Skip to content

Hang issue while loading openblas.so on low memory systems #5289

Open
@vinithakv

Description

@vinithakv

Hi,
When loading libopenblas.so with OpenMP support on a low memory host the program hangs in a loop trying to mmap buffers (In blas_memory_alloc)
This can be reproduced by following testcase on a Linux system.

import os
import resource
import multiprocessing

def limitMemory(maxRAM):
    bytesLimit = maxRAM * 1024 ** 3
    resource.setrlimit(resource.RLIMIT_AS, (bytesLimit, bytesLimit))

def limitCPU(numOfCPUs):
    try:
        CPUs = list(range(numOfCPUs))
        os.sched_setaffinity(0, CPUs)
    except AttributeError:
        print("Error restricting CPU resources")

limitMemory(2)
print("Memory limit set")
limitCPU(1)
print("CPU limit set")
pid = os.getpid()
print("The PID of the curirent process is: ",pid)
openblas_so = cdll.LoadLibrary("/usr/lib64/libopenblaso.so.0")
#import numpy as np
print(openblas_so)
#print(np)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions