Define thread pool size by NUM_THREADS.