(Manjaro Linux) OpenMPI не работает с какой-либо скомпилированной C-программой - PullRequest
0 голосов
/ 23 июня 2018

У меня Manjaro Linux 17.1.10 (ядро 4.17.0-2) в ThinkPad T420 (Core i5 2450M, обновлена ​​до 8 ГБ ОЗУ), и я пытаюсь запустить некоторые программы на C с использованием OpenMPI (версия 3.1.0) но у меня проблемы с запуском программ.

Я могу без проблем скомпилировать их как из терминала, используя mpicc, так и с помощью опции "build" в Ecplipse, но когда я пытаюсь запустить их, либо из терминала, либо в Eclipse (настроен как параллельное приложение в опциях запуска), я ошибки, независимо от того, какой код я запускаю.

Я пытаюсь запустить проект MPI hello world C, который поставляется с Ecipse Parallel:

/*
 ============================================================================
 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, у меня будут другие результаты, в зависимости от числа выбранных процедур (-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/

И окно "о" Eclipse

Также я установил OpenMPI различными способами: из репозитория Manjaro, используя pacman, используя pamac (pacman / yaourt GUI) и версию git из AUR, используя yaourt и pamac.

...