Search code examples
deep-learningmxnet

In Deep Learning "mxnet", restrict number of core (cpu)


The command "ctx=mx.cpu()" is taking all available CPU. How to restrict to use a certain number only - say 6 out of 8 core


Solution

  • Unfortunately - no. Even though the cpu context has int as an input argument:

    def cpu(device_id=0):
        """Returns a CPU context.
    

    according to the official documentation:

     Parameters
     ----------
     device_id : int, optional
         The device id of the device. `device_id` is not needed for CPU.
         This is included to make interface compatible with GPU.
    

    However, in theory, it might be changed in the future since the device_id argument is there. But for now MXNet takes all available cores.