每个内核仅分配一个线程
一.环境(Rocky 8.8/openEuler 22.03 , slurm 23.02)
1. Node
Nodename |
N1 |
N2 |
N3 |
N5 |
Number of Sockets |
2 |
2 |
2 |
1 |
Number of Cores per Socket |
4 |
4 |
4 |
4 |
Total Number of Cores |
8 |
8 |
8 |
4 |
Number of Threads (CPUs) per Core |
1 |
1 |
1 |
2 |
Total Number of CPUs |
8 |
8 |
8 |
8 |
2. Partition
PartitionName |
Part001 |
Part003 |
Nodes |
N1/N2/N3 |
N5 |
Default |
YES |
- |
二. Job 运行
1.Job 需求
一个job需要 8 个CPUs (8 tasks with no overcommitment).在节点 n3 上运行作业,每个核心仅分配一个线程.
2. 任务分布
Nodename |
N5 |
|||||||||||||||
Socket id |
0 |
0 |
||||||||||||||
Core id |
0 |
1 |
2 |
3 |
0 |
1 |
2 |
3 |
||||||||
CPU id |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Number of Allocated CPUs |
4 |
4 |
||||||||||||||
Allocated CPU ids |
0 2 4 6 |
8 10 12 14 |
3. 参数配置
SelectType=select/cons_tres
SelectTypeParameters=CR_CPU
4. 执行命令
srun --partition --ntasks=8 --hint=multithread sleep 60
三. Log 日志
1. N5
[2024-02-07T16:46:47.145] task/affinity: lllp_distribution: JobId=15 binding: threads, dist 8192
[2024-02-07T16:46:47.145] task/affinity: _task_layout_lllp_cyclic: _task_layout_lllp_cyclic
[2024-02-07T16:46:47.145] task/affinity: _lllp_generate_cpu_bind: _lllp_generate_cpu_bind jobid [15]: mask_cpu, 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80
[2024-02-07T16:47:47.376] [15.0] done with job
四. 总结
通过log日志首先可用确定多线程分配选择分区Part003,及分区节点N5上执行tasks.其次,通过log中的cpu_mask (0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80)可用看出,该Job使用的CPUs位置.