Equation Solution  
    High Performance by Design
Navigation Menu
  neuLoop  ⇒  Functions  ⇓  



Function nlp$use


SYNTAX
      call nlp$use(cores)
where cores, a 4-byte integer, is the number of soft cores. neuLoop uses soft cores for parallel computing. Before dispatching a job to soft cores, the number of soft cores must be defined. If the cores that are provided in the subroutine nlp$use is invalid, e.g., 0 or negative number or more than physical cores, neuLoop set the number to the physical cores. For an attempt to use the whole physical cores, user can simply input an invalid number, e.g.,

      call nlp$use(0)
That defines soft cores to the number of physical cores because 0 is an invalid number.

PURPOSE

        The function nlp$use is to define number of soft cores. Application can change the number of soft cores at any time. In an application when there is no much parallelism for parallel computing, application can use the function, nlp$use, to reduce soft cores; When with more parallelism, the application can increase soft cores. For example, an application can do the following
 ... ...
 call nlp$use(4)
 ... !! parallel computing
 call nlp$use(16) !! more parallelism
 ... !! parallel computing
 ... !! parallel computing
 call nlp$use(2)  !! less parallelism
 ... !! parallel computing
        A demand to increase soft cores can be executed immediately. However, any request to reduce soft cores is not executed immediately. A soft core cannot be terminated when it is in the middle of computing. For example, if there are four soft cores busy in the jobs. Any demand to reduce one soft core is not executed immediately, but needs to wait for a soft core turning to a "break" status that allows a soft core to be terminated. After a soft core is terminated, all the remaining jobs will be distributed to the remaining soft cores.

        Terminating soft core also has a negative effect. Soft cores are distributed in processor groups. An application may employ more than one processor group. Ideally, a soft core in the last group and last index is a candidate to be terminated. However, the soft core that will be terminated is the first one that turns to a "break" status, which cannot guarantee to have an ideal soft core to be terminated.

        Repeatedly increasing and reducing soft cores is not a good practice. A program has a non-reusable buffer with 1024 slots to track the soft cores, which should be sufficient for normal use but may overflow if repeatedly increasing and reducing soft cores. Do it when necessary. When soft cores have nothing to do, they sit idle waiting for the jobs coming. When a soft core sits idle, soft core does not consume CPU time.

        Usually, the function nlp$use is called once before dispatching the first job and without any further change.