Skip to content

Restricting core usage #179

@PaMartini

Description

@PaMartini

Is there a way to specify the cores that are used during training?
I am using the Python interface to Somoclu.
I tried:

import psutil
import os

cores = [0,1,3]

p = psutil.Process(os.getpid())
p.cpu_affinity(cores)

os.environ["OMP_PROC_BIND"] = 'TRUE'
os.environ["OMP_PLACES"] = ','.join(f'{{{core}}}' for core in cores)

... script that uses Somoclu to train a SOM ...

But this does not work for me ...
(I guess the parallelization of Somoclu ignores the set parameters.)
(Also, I know that this is possible via taskset, but I would prefer to specify the cores in the python code.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions