int flag;
MPI_Initialized(&flag);
if (!flag) {
if(MPI_Init(&argc,&argv) != MPI_SUCCESS) {
fprintf(stdout," DDI: MPI_Init failed.\n");
fflush(stdout); exit(911);
}
}
# if defined DDI_SOC
extern int gargc;
extern int ddi_initialized;
extern char **gargv;
extern ddi_finalized;
# endif
# if defined DDI_SOC
DDI_Init(gargc, gargv);
MAX_DEBUG((stdout," DDI: Calling DDI_Init(gargc, gargv).\n"))
# endif
# if defined DDI_MPI
DDI_Init(argc,argv);
MAX_DEBUG((stdout," DDI: Calling DDI_Init(argc, argv).\n"))
# endif
# if defined DDI_SOC
# include "ddiarg.h"
# endif
/* ---------------------------------------- *\
Initialize arguments for the DDI process
\* ---------------------------------------- */
/************************************************************\
use the original argument list for ddi-mpi model (Fang Peng) * \***********************************************************/
# if defined DDI_MPI
nargs = info->ddiarg + info->nnodes + 8;
rargs = (char **) Malloc(nargs*sizeof(char*));
for(i=1,r=0; i<info->ddiarg-1; i++) rargs[r++] = argv[i];
rargs[r++] = ddiinfo;
rargs[r++] = info->kickoffhost; /* kickoff host name */
rargs[r++] = portid; /* kickoff port number */
rargs[r++] = nodeid; /* rank of this node */
rargs[r++] = procid; /* rank of this process */
rargs[r++] = snodes; /* number of nodes */
rargs[r++] = sprocs; /* number of processors */
for(i=0,iarg=info->nodearg; i<info->nnodes; i++,iarg++) {
rargs[r++] = argv[iarg];
}
rargs[r] = NULL;
# endif
/*
* use the modified argument list for ddi-sockets model (Fang Peng)
*/
# if defined DDI_SOC
nargs = info->ddiarg + 2 * info->nnodes + 2*8;
rargs = (char **) Malloc(nargs*sizeof(char*));
for(i=1,r=0; i<info->ddiarg-1; i++) rargs[r++] = argv[i];
// change the argument to the format that cca framework can detect
rargs[r++] = "--ddihost";
rargs[r++] = info->kickoffhost; /* kickoff host name */
rargs[r++] = "--ddiportid";
rargs[r++] = portid; /* kickoff port number */
rargs[r++] = "--ddinodeid";
rargs[r++] = nodeid; /* rank of this node */
rargs[r++] = "--ddiprocid";
rargs[r++] = procid; /* rank of this process */
rargs[r++] = "--ddisnodes";
rargs[r++] = snodes; /* number of nodes */
rargs[r++] = "--ddisprocs";
rargs[r++] = sprocs; /* number of processors */
rargs[r++] = "--ddinumrest";
char numrest[8];
sprintf(numrest,"%d",info->nnodes);
rargs[r] = numrest;
r++;
for(i=0,iarg=info->nodearg; i<info->nnodes; i++,iarg++) {
rargs[r] = (char*)malloc(sizeof(char*));
sprintf(rargs[r],"%s%d","--ddirest",i);
r++;
rargs[r++] = argv[iarg];
}
/*
* add one more argument to the argument lists
* --ddiscr path-to-scratch-directory
*/
rargs[r++] = "--ddiscr";
int not_it;
for(i=0,not_it=1; i<info->argc-1 && not_it; i++)
not_it = strcmp(argv[i],"-scr");
if(not_it==1) {
fprintf(stdout," DDI: Invalid command-line arguments: Missing -scr!\n");
Fatal_error(911);
}
rargs[r++] = argv[i];
rargs[r] = NULL; /* set the last argument to NULL */
/* print out the argument lists that passed to the program */
fprintf(stdout, "In kickoff_local.c: nargs = %d \n", nargs);
for(i=0; i<nargs; i++) {
fprintf(stdout, "rargs[%d] = %s ; ", i, rargs[i]);
}
fprintf(stdout, "\n\n");
r=r-1;
# endif
/********************** END *********************/
The available input options for the GAMESS.ModelFactory component is as the follows. Parameter Port: CONFIG