简体   繁体   English

具有多处理器的服务器,如何启动代码

[英]Server with multi-processor, how to launch code

I don't have a big knowledge in hardware, GPU and CPU so I'm trying to create it.我在硬件、GPU 和 CPU 方面没有丰富的知识,所以我正在尝试创建它。 I have a server with N processor, the description for each of them is more or less the following one:我有一台带有 N 个处理器的服务器,每个处理器的描述或多或少如下:

processor   : 63
vendor_id   : AuthenticAMD
cpu family  : 25
model       : 1
model name  : AMD EPYC 7313 16-Core Processor
stepping    : 1
microcode   : 0xa001119
cpu MHz     : 3724.322
cache size  : 512 KB
physical id : 1
siblings    : 32
core id     : 15
cpu cores   : 16
apicid      : 63
initial apicid  : 63
fpu     : yes
fpu_exception   : yes
cpuid level : 16
wp      : yes

I don't have a job scheduler, so I'm using tmux or screen to deal with my code.我没有作业调度程序,所以我使用 tmux 或 screen 来处理我的代码。 My question is, how can I deal with the processor and use like 3 of them, or less or more, and run my python code?我的问题是,我如何处理处理器并使用它们中的 3 个,或更少或更多,并运行我的 python 代码? I'm very confused about that.我对此很困惑。

Thank you谢谢

You probably want to divide your work into tasks that can run independently from each other and then have them in their own processes via forking (if they don't need to communicate with each other and eg just store their results somewhere on disk) or create threads to run them.您可能希望将您的工作划分为可以彼此独立运行的任务,然后通过分叉将它们放在自己的进程中(如果它们不需要相互通信,例如只需将它们的结果存储在磁盘上的某个位置)或创建线程来运行它们。

A single thread will always only use a single CPU, you need multiple threads to use more CPUs.单个线程将始终只使用单个 CPU,您需要多个线程才能使用更多 CPU。 Each process has at least one thread, that's why creating multiple processes would work, too.每个进程至少有一个线程,这就是为什么创建多个进程也可以工作的原因。

Since you mention tmux , maybe bash's job control can help you - short example would be my_script.py input_file & my_script.py another_input_file , starting two instances of my_script.py to run at the same time.既然你提到tmux ,也许 bash 的作业控制可以帮助你 - 简短的例子是my_script.py input_file & my_script.py another_input_file ,同时启动my_script.py的两个实例运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 scikit-learn在多处理器环境中搜索网格 - scikit-learn grid search on multi-processor environment 具有单核处理器的多线程代码和具有多核处理器的单线程代码 - Multi-thread code with single-core processor and single-thread code with multi-core processor goroutines 在多核处理器上的表现如何 - How does goroutines behave on a multi-core processor 如何让Java使用我的多核处理器和GZIPInputStream? - How do I get Java to use my multi-core processor with GZIPInputStream? 多核处理器上的多线程,并发和并行 - Multi-threading, concurrency and parallelism on a multicore processor SQL Server并行逻辑处理器或物理核心 - SQL Server parallelism logical processor or physical cores TPL如何在多核处理器中工作 - How TPL works in a multicore processor 如何优化矩阵乘法(matmul)代码,以便在单个处理器内核上快速运行 - how to optimize matrix multiplication (matmul) code to run fast on a single processor core Julia:如何将数据复制到Julia中的另一个处理器 - Julia: How to copy data to another processor in Julia java代码是否自动使用多个处理器核心(如果可用) - Does java code automatically utilize multiple processor cores if available
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM