question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BLAS : Program is Terminated. Because you tried to allocate too many memory regions.

See original GitHub issue

When training K-nearest-neighbors (KNN) models, sometimes a rare error can occur that crashes the entire process:

BLAS : Program is Terminated. Because you tried to allocate too many memory regions.
Segmentation fault: 11

It has so far only occurred on machines with >300 GB of memory (2 confirmed instances). In both cases, the system was not low on memory and had plenty to complete the task, yet the error still occurred.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

4reactions
awethaileslassiecommented, Sep 23, 2021

This worked for me. “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

https://www.discoverbits.in/2509/program-terminated-because-tried-allocate-memory-regions

1reaction
Innixmacommented, Apr 23, 2021

Thanks for the info!

To understand how to specify custom hyperparameters, refer to the hyperparameters argument documentation: https://auto.gluon.ai/stable/_modules/autogluon/tabular/predictor/predictor.html#TabularPredictor.fit

The default hyperparameters are:

hyperparameters = {
    'NN': {},
    'GBM': [
        {},
        {'extra_trees': True, 'ag_args': {'name_suffix': 'XT'}},
        'GBMLarge',
    ],
    'CAT': {},
    'XGB': {},
    'FASTAI': {},
    'RF': [
        {'criterion': 'gini', 'ag_args': {'name_suffix': 'Gini', 'problem_types': ['binary', 'multiclass']}},
        {'criterion': 'entropy', 'ag_args': {'name_suffix': 'Entr', 'problem_types': ['binary', 'multiclass']}},
        {'criterion': 'mse', 'ag_args': {'name_suffix': 'MSE', 'problem_types': ['regression']}},
    ],
    'XT': [
        {'criterion': 'gini', 'ag_args': {'name_suffix': 'Gini', 'problem_types': ['binary', 'multiclass']}},
        {'criterion': 'entropy', 'ag_args': {'name_suffix': 'Entr', 'problem_types': ['binary', 'multiclass']}},
        {'criterion': 'mse', 'ag_args': {'name_suffix': 'MSE', 'problem_types': ['regression']}},
    ],
    'KNN': [
        {'weights': 'uniform', 'ag_args': {'name_suffix': 'Unif'}},
        {'weights': 'distance', 'ag_args': {'name_suffix': 'Dist'}},
    ],
}

You would want to edit KNN (example to enforce using only 16 cores):

'KNN': [
    {'weights': 'uniform', 'ag_args': {'name_suffix': 'Unif'}, 'n_jobs': 16},
    {'weights': 'distance', 'ag_args': {'name_suffix': 'Dist'}, 'n_jobs': 16},
],

Another option is to disable KNN entirely:

excluded_model_types = ['KNN']
Read more comments on GitHub >

github_iconTop Results From Across the Web

BLAS : Program is Terminated. Because you tried to allocate ...
When training K-nearest-neighbors (KNN) models, sometimes a rare error can occur that crashes the entire process: BLAS : Program is ...
Read more >
BLAS : Program is Terminated. Because you ... - Google Groups
Because you tried to allocate too many memory regions. ... I solved this problem as this post Training a Classifier Problem: BLAS :...
Read more >
BLAS : Program is Terminated. Because you tried to ... - GitLab
0%BLAS : Program is Terminated. Because you tried to allocate too many memory regions. however the node has 256 GB of memory and...
Read more >
"Too many memory regions" error with Dask - Stack Overflow
Short Answer. Dask and OpenBLAS are both trying to parallelize at the same time. This triggers a check in OpenBLAS which causes a...
Read more >
BLAS - Program is Terminated. Because you tried to allocate ...
BLAS : Program is Terminated. Because you tried to allocate too many memory regions ... I tried different covariance_type, but nothing worked. How...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found