- 
  Notifications
 You must be signed in to change notification settings 
- Fork 337
-
By default, STUMPY uses all of the local threads when computing the matrix profile. Instead of using all threads, how can we limit or set the number of threads to be used?
Note: This question is concerning only the local threads on a single (1) machine/server and is different from "distributed" computation across multiple machines/servers!
Beta Was this translation helpful? Give feedback.
All reactions
Internally, STUMPY uses numba for its parallel computations. Thus, the number of threads can be controlled by calling the numb.set_num_threads function:
import numpy as np
import stumpy
import numba
if __name__ == "__main__":
 T = np.random.rand(10_000)
 m = 50
 numba.set_num_threads(2) # This will use only 2 threads
 mp = stumpy.stump(T, m)
Note that calling numba.set_num_threads will affect the number of threads used in ALL parallel computations in STUMPY and not only stumpy.stump. See the numba documentation for more information.
Replies: 1 comment
-
Internally, STUMPY uses numba for its parallel computations. Thus, the number of threads can be controlled by calling the numb.set_num_threads function:
import numpy as np
import stumpy
import numba
if __name__ == "__main__":
 T = np.random.rand(10_000)
 m = 50
 numba.set_num_threads(2) # This will use only 2 threads
 mp = stumpy.stump(T, m)
Note that calling numba.set_num_threads will affect the number of threads used in ALL parallel computations in STUMPY and not only stumpy.stump. See the numba documentation for more information.
Beta Was this translation helpful? Give feedback.