aertslab / arboreto

A scalable python-based framework for gene regulatory network inference using tree-based ensemble regressors.
BSD 3-Clause "New" or "Revised" License
52 stars 24 forks source link

How to set the number of cores used by GRNboost2 #34

Open divyanshusrivastava opened 1 year ago

divyanshusrivastava commented 1 year ago

I cannot find any parameter which limits the number of cores used in GRNboost2. I am using a shared server, and my code is blocking all the resource available. Wha tcould be way the limit it to only use a predefined number of nodes, similar to '--num-worker' argument in the command line grnboost call. ?

divyanshusrivastava commented 1 year ago

One way of doing this could be to create a client with a local cluster already set to the number of workers to use. Something like

from distributed import Client, LocalCluster client = Client(LocalCluster( name='grn_call', n_workers=4, threads_per_worker=4
))

adjacencies = grnboost2( ex_matrix, tf_names=tf_names, client_or_address=client )