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

Ruwn,

To tell PTP you'd like more than one process, you need to setup a parallel application in the Eclipse "Run Configurations" as opposed to a "local C/C++" app (see attached pic).

You'll also want to go through the PTP help plugin (it's pretty clear) to setup a resource manager (e.g. mpich, etc). Just setup a local resource manager for starters. Once your resource manager is setup and started, you can simply select the parallel run configuration you setup previously and run it.

Hope this helps.

-Alan



ruwn 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

JPEG image


Back to the top