Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-user] problem with using ptp

To tell PTP to run with more than one process, use the launch configuration dialog.
Run > Run Configurations...
I don't have it in front of me now (and the eclipse help server is down for maintenance or I would paste the URL of the dialog from our help)
But I think it's in the "Main" tab

On Mon, Sep 6, 2010 at 4:55 PM, ruwn <info@xxxxxxxxxx> wrote:
Dear All,

I installed PTP 3.0 and everything went fine. If I compile and run the
MPI Hello World C Project, i get this output:

Num processes: 1
PI is approximately 3.1415926535904264


If I want to compile and run my own programm (see below), the compiling
works fine.
But when i want to run it, the only output is:
Process: 0

I think, that I have to tell PTP to use more than 1 process, but i can't
find the setting.

When I use my shell and write:
"mpiexec -n 4 testprogram"
that output is produced:
Process: 0Array D= 3.000000
Array D= 4.000000
Array D= 5.000000
Array D= 6.000000


thx and best regards
ruwn


here the code:

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <mpi.h>

#define TAG 123

int main (int argc, char **argv)
{
       int i;
       int myrank, nprocs;
       int namelen;
       char name[MPI_MAX_PROCESSOR_NAME];

       MPI_Status status;

       /* MPI initialisieren und Argumente setzen */
       MPI_Init(&argc, &argv);

       /* Anzahl der Prozesse erfragen */
       MPI_Comm_size(MPI_COMM_WORLD, &nprocs);

       /* Eigenen Rang erfragen */
       MPI_Comm_rank(MPI_COMM_WORLD, &myrank);

       /* Rechnernamen erfragen */
       MPI_Get_processor_name(name, &namelen);

       if (myrank==0) {
       printf("Process: %i", myrank);

               double A[4];
               double D[4];
               for (i=0;i<4;i++)
                       A[i]=i+1;
               MPI_Send(A, 4, MPI_DOUBLE, 1, 0, MPI_COMM_WORLD);
               MPI_Recv(D, 4, MPI_DOUBLE, 2, 0, MPI_COMM_WORLD, &status);
               for (i=0;i<4;i++)
                       printf("Array D= %lf \n", D[i]);
       }

       if (myrank == 1) {
       printf("Process: %i", myrank);
               double B[4];
               MPI_Recv(B, 4, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &status);
               for (i=0;i<4;i++)
                       B[i]+=1;
               MPI_Send(B, 4, MPI_DOUBLE, 2, 0, MPI_COMM_WORLD);
       }

       if (myrank == 2) {
       printf("Process: %i", myrank);
               double C[4];
               MPI_Recv(C, 4, MPI_DOUBLE, 1, 0, MPI_COMM_WORLD, &status);
               for (i=0;i<4;i++)
                       C[i]+=1;
               MPI_Send(C, 4, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD);
       }

       /* MPI geordnet beenden */
       MPI_Finalize();

       return 0;
}



_______________________________________________
ptp-user mailing list
ptp-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ptp-user



--
...Beth



Back to the top