pwollstadt / IDTxl

The Information Dynamics Toolkit xl (IDTxl) is a comprehensive software package for efficient inference of networks and their node dynamics from multivariate time series data using information theory.
http://pwollstadt.github.io/IDTxl/
GNU General Public License v3.0
237 stars 76 forks source link

How to use GPU acceleration? #77

Closed nicrie closed 2 years ago

nicrie commented 2 years ago

I want to run the following analysis using GPU acceleration:

data = Data(X, dim_order='sp')

Adding data with properties: 7 processes, 6000 samples, 1 replications

network = MultivariateTE()
settings = {
    'cmi_estimator': 'OpenCLKraskovCMI',
    'max_lag_sources': 3,
    'min_lag_sources': 3,
    'max_lag_targets': 1,
    'min_lag_targets': 1,
    'tau_sources' : 1,
    'tau_target' : 1
}
results = network.analyse_single_target(settings=settings, data=data, target=6)

When running the analysis, however, only 1 core is working.

I'm running on Ubuntu 20.04 with a GeForce RTX 2060 Mobile using a virtual anaconda environment where I have installed

ocl-icd                   2.3.1                h7f98852_0    conda-forge
ocl-icd-system            1.0.0                         1    conda-forge
pyopencl                  2021.2.10        py38h2b96118_0    conda-forge

for GPU-support following the instructions.


Note: The current setting is also quite feasible using CPU but I will have to scale up the analysis to a point where GPU would be very convenient.

mwibral commented 2 years ago

Dear Niclas,

I'm not sure if anyone replied to this yet. Your code should already run on GPU, since you are using the OpenCL estimator. What is possibly missing is the ID of the GPU that you want to run on (settings-variable gpu_id or gpuid - i would have to check;  in a system with a single GPU that would be '0', but in a 10-GPU server that could be any number between 0 and 9, in a notebook with dual graphics iGPU and dGPU it could be 0 or 1).

You will still see only one or two CPU cores working, but nvidia-smi on the command line should show you that the GPU is active.

With respect to scaling it's good to know that for very many sources/targets and a high number of statistical surrogates used in testing the GPU is good. If the data get very long in time, though, say 10.000.000 data points then the multithreaded estimation on CPU scales better (s log s, where s is the number of time samples, on GPU the scaling is s^2).

Best,

Michael

On 11.12.21 16:23, Niclas Rieger wrote:

I want to run the following analysis using GPU acceleration:

data = Data(X,dim_order='sp')

Adding data with properties:7 processes,6000 samples,1 replications

network = MultivariateTE() settings = { 'cmi_estimator':'OpenCLKraskovCMI', 'max_lag_sources':3, 'min_lag_sources':3, 'max_lag_targets':1, 'min_lag_targets':1, 'tau_sources' :1, 'tau_target' :1 } results = network.analyse_single_target(settings=settings,data=data,target=6)

When running the analysis, however, only 1 core is working.

I'm running on Ubuntu 20.04 with a GeForce RTX 2060 Mobile using a virtual anaconda environment where I have installed

|ocl-icd 2.3.1 h7f98852_0 conda-forge ocl-icd-system 1.0.0 1 conda-forge pyopencl 2021.2.10 py38h2b96118_0 conda-forge |

for GPU-support following the instructions https://github.com/pwollstadt/IDTxl/wiki/Installation-and-Requirements.


Note: The current setting is also quite feasible using CPU but I will have to scale up the analysis to a point where GPU would be very convenient.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pwollstadt/IDTxl/issues/77, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFJQGTXXOHEWGUDWAW5MXDUQNUILANCNFSM5J3D2CUQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

pwollstadt commented 2 years ago

Hi @nicrie, I would close this issue since this is more about how to use the toolbox than an actual problem with the code. Feel free to reopen the issue or have a look at our mailing list: https://groups.google.com/g/idtxl