如何在 julia 中将线程添加到 ParallelAccelerator.jl?
How to add Threads to ParallelAccelerator.jl in julia?
我正在阅读 documentations.But 我从不喜欢“我可以通过哪个命令为 ParallelAccelerator.jl 添加线程?”
是 export JULIA_NUM_THREADS=4
或 export OMP_NUM_THREADS=4
?
我怎样才能获得代码中的线程数?我可以通过代码中的 Threads.nthread()
获取线程数吗?
谢谢。
使用JULIA_NUM_THREADS
设置线程数,注意这必须在启动julia进程之前完成。您可以阅读有关 environment variables in the manual.
是的,Base.Threads.nthreads
的文档:
help?> Base.Threads.nthreads
Threads.nthreads()
Get the number of threads available to the Julia process. This is the
inclusive upper bound on threadid().
我正在阅读 documentations.But 我从不喜欢“我可以通过哪个命令为 ParallelAccelerator.jl 添加线程?”
是 export JULIA_NUM_THREADS=4
或 export OMP_NUM_THREADS=4
?
我怎样才能获得代码中的线程数?我可以通过代码中的 Threads.nthread()
获取线程数吗?
谢谢。
使用JULIA_NUM_THREADS
设置线程数,注意这必须在启动julia进程之前完成。您可以阅读有关 environment variables in the manual.
是的,Base.Threads.nthreads
的文档:
help?> Base.Threads.nthreads
Threads.nthreads()
Get the number of threads available to the Julia process. This is the
inclusive upper bound on threadid().