Go to USC home page USC Logo USC HPCG
UNIVERSITY OF SOUTH CAROLINA
GET ACCESS | NICK STATUS | DOCUMENTATION | NICK SPECIFICATIONS

HPCG HOME

ABOUT HPCG

SYSTEMS & ACCESS

PROJECTS & PUBLICATIONS

TUTORIALS & DOCS

COLLEGE HOME PAGE

USEFUL COMMANDS

COMPILING CODE

USING THE QUEUE

DOCUMENTATION
USC  THIS SITE

Simple Program Execution

Example of an MPI Program mpitest.c

/* program hello */
/* Adapted from mpihello.f by drs */

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

int main(int argc, char **argv)
{
int *buf, i, rank, nints, len;
char hostname[256];

MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
gethostname(hostname,255);
printf("Hello world! I am process number: %d on host %s\n", rank, hostname);
MPI_Finalize();
return 0;
}
 

Commands to compile:

$mpicc -c -O -Wall -D_REENTRANT -lm hello.c

$mpicc -O -Wall -D_REENTRANT -lm -o hello hello.o

RETURN TO TOP
USC LINKS: DIRECTORY MAP EVENTS VIP
SITE INFORMATION