sgdml/predict.py
def _set_num_workers(
        self, num_workers=None
    ):  # TODO: complain if chunk or worker parameters do not fit training data (this causes issues with the caching)!!
        """
        Set number of processes to use during prediction.

        If bulk_mp == True, each worker handles the whole generation of single prediction (this if for querying multiple geometries at once)
        If bulk_mp == False, each worker may handle only a part of a prediction (chunks are defined in 'wkr_starts_stops'). In that scenario multiple proesses
        are used to distribute the work of generating a single prediction

        This number should not exceed the number of available CPU cores.

        Note
        ----
                This parameter can be optimally determined using
                `prepare_parallel`.

        Parameters
        ----------
                num_workers : int, optional
                        Number of processes (maximum value is set if
                        `None`).
        """

        if self._num_workers is not num_workers:

            if self.pool is not None:
                self.pool.close()
                self.pool.join()
                self.pool = None

            self._num_workers = 1
            if num_workers is None or num_workers > 1:
                self.pool = mp.Pool(processes=num_workers)
                self._num_workers = self.pool._processes

        # Data ranges for processes
        if self._bulk_mp:
            wkr_starts = [self.n_train]
        else:
            wkr_starts = list(
                range(
                    0,
                    self.n_train,
                    int(np.ceil(float(self.n_train) / self._num_workers)),
                )
            )
        wkr_stops = wkr_starts[1:] + [self.n_train]

        self.wkr_starts_stops = list(zip(wkr_starts, wkr_stops))

        Set number of processes to use during prediction.

        If bulk_mp == True, each worker handles the whole generation of single prediction (this if for querying multiple geometries at once)
        If bulk_mp == False, each worker may handle only a part of a prediction (chunks are defined in 'wkr_starts_stops'). In that scenario multiple proesses
        are used to distribute the work of generating a single prediction

        This number should not exceed the number of available CPU cores.

        Note
        ----
                This parameter can be optimally determined using
                `prepare_parallel`.

        Parameters
        ----------
                num_workers : int, optional
                        Number of processes (maximum value is set if
                        `None`).
        
Set number of processes to use during prediction.
If bulk_mp == True, each worker handles the whole generation of single prediction (this if for querying multiple geometries at once)
If bulk_mp == False, each worker may handle only a part of a prediction (chunks are defined in 'wkr_starts_stops'). In that scenario multiple proesses
are used to distribute the work of generating a single prediction

This number should not exceed the number of available CPU cores.

Note

This parameter can be optimally determined using
`prepare_parallel`.

Parameters

num_workers : int, optional
Number of processes (maximum value is set if
`None`).
Set number of processes to use during prediction . If bulk_mp == True each worker handles the whole generation of single prediction ( this if for querying multiple geometries at once ) If bulk_mp == False each worker may handle only a part of a prediction ( chunks are defined in ' wkr_starts_stops ' ) . In that scenario multiple proesses are used to distribute the work of generating a single prediction This number should not exceed the number of available CPU cores . Note This parameter can be optimally determined using ` prepare_parallel ` . Parameters num_workers : int optional Number of processes ( maximum value is set if ` None ` ) .
def _set_num_workers(
        self, num_workers=None
    ):  
        if self._num_workers is not num_workers:
            if self.pool is not None:
                self.pool.close()
                self.pool.join()
                self.pool = None
            self._num_workers = 1
            if num_workers is None or num_workers > 1:
                self.pool = mp.Pool(processes=num_workers)
                self._num_workers = self.pool._processes
        if self._bulk_mp:
            wkr_starts = [self.n_train]
        else:
            wkr_starts = list(
                range(
                    0,
                    self.n_train,
                    int(np.ceil(float(self.n_train) / self._num_workers)),
                )
            )
        wkr_stops = wkr_starts[1:] + [self.n_train]
        self.wkr_starts_stops = list(zip(wkr_starts, wkr_stops))
def _set_num_workers ( self , num_workers = None ) : if self . _num_workers is not num_workers : if self . pool is not None : self . pool . close ( ) self . pool . join ( ) self . pool = None self . _num_workers = 1 if num_workers is None or num_workers > 1 : self . pool = mp . Pool ( processes = num_workers ) self . _num_workers = self . pool . _processes if self . _bulk_mp : wkr_starts = [ self . n_train ] else : wkr_starts = list ( range ( 0 , self . n_train , int ( np . ceil ( float ( self . n_train ) / self . _num_workers ) ) , ) ) wkr_stops = wkr_starts [ 1 : ] + [ self . n_train ] self . wkr_starts_stops = list ( zip ( wkr_starts , wkr_stops ) )
Set number of processes to use during prediction.
Set number of processes to use during prediction .
# TODO: complain if chunk or worker parameters do not fit training data (this causes issues with the caching)!! """
        Set number of processes to use during prediction.

        If bulk_mp == True, each worker handles the whole generation of single prediction (this if for querying multiple geometries at once)
        If bulk_mp == False, each worker may handle only a part of a prediction (chunks are defined in 'wkr_starts_stops'). In that scenario multiple proesses
        are used to distribute the work of generating a single prediction

        This number should not exceed the number of available CPU cores.

        Note
        ----
                This parameter can be optimally determined using
                `prepare_parallel`.

        Parameters
        ----------
                num_workers : int, optional
                        Number of processes (maximum value is set if
                        `None`).
        """ # Data ranges for processes
self
num_workers