Exemplo n.º 1
0
StgData* StgInit( int argc, char* argv[] ) {
   StgData* data = (StgData*) malloc(sizeof(StgData));
   *data = (StgData){.comm = NULL, .rank=-1, .nProcs=-1, .dictionary=NULL, .argcCpy=NULL, .argvCpy=NULL }; 

   //lets copy all this data for safety
   data->argcCpy = argc;
   data->argvCpy = (char**) malloc((argc+1)*sizeof(char*));
   int ii;
   for(ii = 0; ii<argc; ii++){
      data->argvCpy[ii] = (char*)malloc(strlen(argv[ii])+1);
      strcpy(data->argvCpy[ii],argv[ii]);
   }
   data->argvCpy[argc] = NULL;  //add sentinel

   MPI_Comm_dup( MPI_COMM_WORLD, &data->comm );
   MPI_Comm_size( data->comm, &data->nProcs );
   MPI_Comm_rank( data->comm, &data->rank );
   StGermain_Init( &(data->argcCpy), &(data->argvCpy) );
   
   return data;
}

int StgFinalise(StgData* data){
   /* Close off everything */
   StGermain_Finalise();
   MPI_Finalize();

   /* free up these guys created earlier */
   int ii;
   for(ii = 0; ii<data->argcCpy; ii++)
   	  free(data->argvCpy[ii]);
   free(data->argvCpy);
   free(data);
   return 0; /* success */
}
Exemplo n.º 2
0
int main( int argc, char** argv ) {
    MPI_Init( &argc, &argv );
    StGermain_Init( &argc, &argv );

    StGermain_Finalise();
    MPI_Finalize();
    return 0;
}
Exemplo n.º 3
0
int main( int argc, char** argv ) {
	MPI_Init( &argc, &argv );
	StGermain_Init( &argc, &argv );
	StgFEM_Init( &argc, &argv );
	PICellerator_Init( &argc, &argv );

	PICellerator_Finalise();
	StgFEM_Finalise();
	StGermain_Finalise();
	MPI_Finalize();
	return 0;
}