ThinkPad T420 (Core i5 2450M、8GB RAM にアップグレード) に Manjaro Linux 17.1.10 (カーネル 4.17.0-2) があり、OpenMPI (バージョン 3.1.0) を使用していくつかの C プログラムを実行しようとしていますが、プログラムの実行に問題があります。
mpicc
ターミナルと Ecplipse の「ビルド」オプションの両方から問題なくコンパイルできますが、ターミナルまたは Eclipse (起動オプションで並列アプリケーションとして構成) から実行しようとすると、エラーが発生します。私が実行するコード。
Ecipse Parallel に付属する MPI hello world C プロジェクトを実行しようとしています。
/*
============================================================================
Name : test.c
Author : MGMX
Version : 1
Copyright : GNU 3.0
Description : Hello MPI World in C
============================================================================
*/
#include <stdio.h>
#include <string.h>
#include "mpi.h"
int main(int argc, char* argv[]){
int my_rank; /* rank of process */
int p; /* number of processes */
int source; /* rank of sender */
int dest; /* rank of receiver */
int tag=0; /* tag for messages */
char message[100]; /* storage for message */
MPI_Status status ; /* return status for receive */
/* start up MPI */
MPI_Init(&argc, &argv);
/* find out process rank */
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
/* find out number of processes */
MPI_Comm_size(MPI_COMM_WORLD, &p);
if (my_rank !=0){
/* create message */
sprintf(message, "Hello MPI World from process %d!", my_rank);
dest = 0;
/* use strlen+1 so that '\0' get transmitted */
MPI_Send(message, strlen(message)+1, MPI_CHAR,
dest, tag, MPI_COMM_WORLD);
}
else{
printf("Hello MPI World From process 0: Num processes: %d\n",p);
for (source = 1; source < p; source++) {
MPI_Recv(message, 100, MPI_CHAR, source, tag,
MPI_COMM_WORLD, &status);
printf("%s\n",message);
}
}
/* shut down MPI */
MPI_Finalize();
return 0;
}
./test
パラメータなしでシンプルを使用してプログラムを実行すると、出力が得られます。
[mgmx@ThinkPad Debug]$ ./test
Hello MPI World From process 0: Num processes: 1
しかし、使用すると、選択mpirun
した pof プロセス ( -np #
) の数に応じて、異なる結果が得られます。しかし、それらはすべてエラーをスローします:
[mgmx@ThinkPad Debug]$ mpirun -np 0 test
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
-------------------------------------------------------
[mgmx@ThinkPad Debug]$ mpirun -np 1 test
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
-------------------------------------------------------
--------------------------------------------------------------------------
mpirun detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:
Process name: [[49948,1],0]
Exit code: 1
--------------------------------------------------------------------------
[mgmx@ThinkPad Debug]$ mpirun -np 2 test
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
-------------------------------------------------------
[mgmx@ThinkPad Debug]$ mpirun -np 3 test
--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 3 slots
that were requested by the application:
test
Either request fewer slots for your application, or make more slots available
for use.
--------------------------------------------------------------------------
[mgmx@ThinkPad Debug]$ mpirun -np 4 test
--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 4 slots
that were requested by the application:
test
Either request fewer slots for your application, or make more slots available
for use.
--------------------------------------------------------------------------
すべてをローカルで実行しています。
以下は、--version
mpicc と mpirun の両方の出力です。
[mgmx@ThinkPad Debug]$ mpicc --version
gcc (GCC) 8.1.1 20180531
Copyright (C) 2018 Free Software Foundation, Inc.
Esto es software libre; vea el código para las condiciones de copia. NO hay
garantía; ni siquiera para MERCANTIBILIDAD o IDONEIDAD PARA UN PROPÓSITO EN
PARTICULAR
[mgmx@ThinkPad Debug]$ mpirun --version
mpirun (Open MPI) 3.1.0
Report bugs to http://www.open-mpi.org/community/help/
また、さまざまな方法で OpenMPI をインストールしました。manjaro リポジトリから pacman を使用して、pamac (pacman/yaourt GUI) を使用して、AUR から git バージョンを yaourt と pamac の両方を使用してインストールしました。