flint_set_num_threads
Synopsis
#include <flint/thread_support.h>void flint_set_num_threads(int num_threads)sourceAllows FLINT to use up to num_threads threads, resizing the global thread pool to num_threads - 1 workers. Must be called from the master thread, outside any parallel region. Throws an exception if threads of the pool are in use.
The first call creates global_thread_pool. Later calls resize it, which joins all existing worker threads and creates new ones, even if the size is unchanged. Without pthreads the value is ignored and FLINT uses one thread.
Guides#
- Multiplying integers and polynomials (
fft) - Where FLINT uses fft_small (
fft_small) - Getting started with fmpz_mpoly (
fmpz_mpoly) - Linear algebra modulo n (
nmod_mat) - Getting started with nmod_mpoly (
nmod_mpoly) - Using the thread pool directly (
thread_pool)
Cite this page
The FLINT team, “flint_set_num_threads (thread_support.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/thread_support/flint_set_num_threads.html (generated 2026-10-20).
@misc{flint-doc-thread-support-flint-set-num-threads,
author = {{The FLINT team}},
title = {{flint\_set\_num\_threads (thread\_support.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/thread_support/flint_set_num_threads.html},
note = {Generated 2026-10-20}
}