gpt4 book ai didi

python - 控制 dask 中的核心/线程数

转载 作者:太空宇宙 更新时间:2023-11-04 00:02:32 26 4
gpt4 key购买 nike

我有一个具有这些规范的工作站:

Architecture:        x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 16
On-line CPU(s) list: 0-15
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 79
Model name: Intel(R) Xeon(R) CPU E5-1660 v4 @ 3.20GHz
Stepping: 1
CPU MHz: 1200.049
CPU max MHz: 3800.0000
CPU min MHz: 1200.0000
BogoMIPS: 6400.08
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 20480K
NUMA node0 CPU(s): 0-15
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts flush_l1d

我已经实现了 dask 来分发一些计算,我正在这样设置一个 Client():

if __name__ == '__main__':
cluster = LocalCluster()
client = Client(cluster, asyncronous=True, n_workers=8,
threads_per_worker=2)
train()

当我使用 dask.compute(*computations, scheduler='distributed') 调用我的 delayed 函数时,dask 显然正在使用所有资源。仪表板如下所示:

Dashboard to show all resources are used

现在,如果我继续将我的 Client() 更改为:

if __name__ == '__main__':
cluster = LocalCluster()
client = Client(cluster, asyncronous=True, n_workers=4,
threads_per_worker=2)
train()

我预计会使用一半的资源,但正如您在我的仪表板上看到的那样,情况并非如此。

Half resources not being used

为什么 dask Client() 仍在使用所有资源?如果对此有任何意见,我将不胜感激。

最佳答案

Client 类将在您尚未指定的情况下为您创建一个集群。 Thos 关键字仅在 传递现有集群实例时有效。您应该将它们放入对 LocalCluster 的调用中:

cluster = LocalCluster(n_workers=4, threads_per_worker=2)
client = Client(cluster, asynchronous=True)

或者你可以简单地跳过创建集群

client = Client(asynchronous=True, n_workers=4, threads_per_worker=2)

关于python - 控制 dask 中的核心/线程数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55229249/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com