我得到;“系统中没有足够的可用插槽”;当我运行mpi时

我得到;“系统中没有足够的可用插槽”;当我运行mpi时,mpi,Mpi,我是一名高中生。学习和编写mpi基本理论时出错。我在网上搜索,尝试了所有的方法,但我不能很好地理解它 #include <stdio.h> #include <mpi.h> int main(int argc, char *argv[]) { int num_procs, my_rank; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &num_pro

我是一名高中生。学习和编写mpi基本理论时出错。我在网上搜索,尝试了所有的方法,但我不能很好地理解它

#include <stdio.h>

#include <mpi.h>

int main(int argc, char *argv[])

{   

   int num_procs, my_rank;

   MPI_Init(&argc, &argv);

   MPI_Comm_size(MPI_COMM_WORLD, &num_procs);

   MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);

   printf("Hello world! I'm rank %d among %d processes.\n", my_rank, num_procs);

   MPI_Finalize();

   return 0;

}
代码非常简单。代码没有问题,我理解得很好

#include <stdio.h>

#include <mpi.h>

int main(int argc, char *argv[])

{   

   int num_procs, my_rank;

   MPI_Init(&argc, &argv);

   MPI_Comm_size(MPI_COMM_WORLD, &num_procs);

   MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);

   printf("Hello world! I'm rank %d among %d processes.\n", my_rank, num_procs);

   MPI_Finalize();

   return 0;

}
此错误发生在-np 3处

mpirun -np 3 ./hello

`There are not enough slots available in the system to satisfy the 3
slots that were requested by the application:

./hello

  Either request fewer slots for your application, or make more slots
  available for use.

   A "slot" is the Open MPI term for an allocatable unit where we can
   launch a process.  The number of slots available are defined by the
   environment in which Open MPI processes are run:

  1. Hostfile, via "slots=N" clauses (N defaults to number of
     processor cores if not provided)
  2. The --host command line parameter, via a ":N" suffix on the
     hostname (N defaults to 1 if not provided)
  3. Resource manager (e.g., SLURM, PBS/Torque, LSF, etc.)
  4. If none of a hostfile, the --host command line parameter, or an
     RM is present, Open MPI defaults to the number of processor cores

In all the above cases, if you want Open MPI to default to the number
of hardware threads instead of the number of processor cores, use the
--use-hwthread-cpus option.

Alternatively, you can use the --oversubscribe option to ignore the
number of available slots when deciding the number of processes to
launch.

我的笔记本电脑是Intel i5,cpu核心是2和4个线程。发生这样的问题是因为只有2个内核吗?我不太明白这部分


在韩国没有太多关于mpi的数据,所以我总是在谷歌上搜索和学习。如果这是原因,有没有办法增加进程的数量?其他人写道,-np 17中有一个错误,他们是如何将过程增加到两位数的?计算机有能力吗?请简单地解释一下,以便我能很好地理解。

我的笔记本电脑是Intel i5,cpu核心是2和4个线程。发生这样的问题是因为只有2个内核吗

#include <stdio.h>

#include <mpi.h>

int main(int argc, char *argv[])

{   

   int num_procs, my_rank;

   MPI_Init(&argc, &argv);

   MPI_Comm_size(MPI_COMM_WORLD, &num_procs);

   MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);

   printf("Hello world! I'm rank %d among %d processes.\n", my_rank, num_procs);

   MPI_Finalize();

   return 0;

}
对。默认情况下,Open MPI使用内核数作为插槽。因此,由于您只有2个内核,因此最多只能启动2个进程

如果这是原因,有没有办法增加进程的数量

是的,如果您使用
--使用HWTREAD CPU
mpirun
命令,您可以在笔记本电脑中使用多达4个mpi进程,因为您的笔记本电脑中有4个线程。尝试运行命令mpirun-np4——使用hwthread CPU a.out

此外,您还可以使用
--oversubscribe
选项来增加大于可用内核/线程的进程数。例如,试试这个
mpirun-np10——超额订阅a.out


默认情况下,1个core=1个插槽,因此您不能要求3个插槽<代码>MPI运行--超额订阅…将允许您运行任意数量的MPI任务。我爱您,非常感谢~!~!欢迎:)。如果答案对您有帮助,您也可以将此答案标记为已接受。