+5 votes
in Machine Learning by (71.8k points)
recategorized by

I am running the GaussianMixture() algorithm, but I am getting an error: "BLAS : Program is Terminated. Because you tried to allocate too many memory regions"

GaussianMixture(n_components=n_clusters, random_state=0, max_iter=500, covariance_type='full').fit(X)

I tried different covariance_type, but nothing worked. How can I fix it?

1 Answer

+1 vote
by (348k points)
selected by
 
Best answer

BLAS stands for Basic Linear Algebra Subprograms. BLAS provides standard interfaces for linear algebra, including BLAS1 (vector-vector operations), BLAS2 (matrix-vector operations), and BLAS3 (matrix-matrix operations).

As per the documentation, if your application is already multi-threaded, it will conflict with OpenBLAS multi-threading. Therefore, you must set OpenBLAS to use a single thread.

So, it seems that your application is conflicting with OpenBLAS multi-threading. You need to run the followings on the command line and it should fix the error:

export OPENBLAS_NUM_THREADS=1
export GOTO_NUM_THREADS=1
export OMP_NUM_THREADS=1

by (73.8k points)
This will set the number of threads to 1. If you need more threads, set it to a higher value depending on the machine.

...