예제 #1
0
void mpi_info_get_valuelen_(MPI_Fint *info, char *key, int *valuelen,
                 int *flag, int *ierr, int keylen )
{
    MPI_Info info_c;
    char *newkey;
    int new_keylen, lead_blanks, i;

    if (key <= (char *) 0) {
        FPRINTF(stderr, "MPI_Info_get_valuelen: key is an invalid address\n");
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    /* strip leading and trailing blanks in key */
    lead_blanks = 0;
    for (i=0; i<keylen; i++) 
        if (key[i] == ' ') lead_blanks++;
        else break;

    for (i=keylen-1; i>=0; i--) if (key[i] != ' ') break;
    if (i < 0) {
        FPRINTF(stderr, "MPI_Info_get_valuelen: key is a blank string\n");
        MPI_Abort(MPI_COMM_WORLD, 1);
    }
    new_keylen = i + 1 - lead_blanks;
    key += lead_blanks;

    newkey = (char *) ADIOI_Malloc((new_keylen+1)*sizeof(char));
    strncpy(newkey, key, new_keylen);
    newkey[new_keylen] = '\0';

    info_c = MPI_Info_f2c(*info);
    *ierr = MPI_Info_get_valuelen(info_c, newkey, valuelen, flag);
    ADIOI_Free(newkey);
}
예제 #2
0
void mpi_info_get_valuelen_f(MPI_Fint *info, char *key,
                             MPI_Fint *valuelen, MPI_Flogical *flag,
                             MPI_Fint *ierr, int key_len)
{
    int c_err, ret;
    MPI_Info c_info;
    char *c_key;
    OMPI_SINGLE_NAME_DECL(valuelen);
    OMPI_LOGICAL_NAME_DECL(flag);

    if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(key, key_len, &c_key))) {
        c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
        *ierr = OMPI_INT_2_FINT(c_err);
        return;
    }
    c_info = MPI_Info_f2c(*info);
    *ierr = OMPI_INT_2_FINT(MPI_Info_get_valuelen(c_info, c_key,
                            OMPI_SINGLE_NAME_CONVERT(valuelen),
                            OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)));
    if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
        OMPI_SINGLE_INT_2_FINT(valuelen);
        OMPI_SINGLE_INT_2_LOGICAL(flag);
    }

    free(c_key);
}
예제 #3
0
static void dump_mpi_info( MPI_Info info, const char * prefix = NULL  ) {
  int nkeys;
  std::stringstream ss;

  ss << "MPI Info";
  if( prefix ) {
    ss << " for " << prefix;
  }
  ss << ":\n";
  
  MPI_Info_get_nkeys(info, &nkeys);
  for( int i=0; i<nkeys; i++ ) {
    char key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL];
    int  valuelen, flag;
    
    MPI_Info_get_nthkey(info, i, key);
    MPI_Info_get_valuelen(info, key, &valuelen, &flag);
    CHECK( flag ) << "somehow key not defined?";
    MPI_Info_get(info, key, valuelen+1, value, &flag);
    CHECK( flag ) << "somehow key not defined?";
    
    ss << "   key " << i << ": " << key << " => " << value;
  }

  LOG(INFO) << ss.str();
}
예제 #4
0
void IMB_print_info()
    /*


       Prints MPI_Info selections (MPI-2 only)



*/
{
    int nkeys,ikey,vlen,exists;
    MPI_Info tmp_info;
    char key[MPI_MAX_INFO_KEY], *value;

    IMB_user_set_info(&tmp_info);

    /* July 2002 fix V2.2.1: handle NULL case */
    if( tmp_info!=MPI_INFO_NULL ) 
    {
        /* end change */

        MPI_Info_get_nkeys(tmp_info, &nkeys);

        if( nkeys > 0) fprintf(unit,"# Got %d Info-keys:\n\n",nkeys);

        for( ikey=0; ikey<nkeys; ikey++ )
        {
            MPI_Info_get_nthkey(tmp_info, ikey, key);

            MPI_Info_get_valuelen(tmp_info, key, &vlen, &exists);

            value = (char*)IMB_v_alloc((vlen+1)* sizeof(char), "Print_Info");

            MPI_Info_get(tmp_info, key, vlen, value, &exists);
            printf("# %s = \"%s\"\n",key,value);

            IMB_v_free ((void**)&value);
        }

        MPI_Info_free(&tmp_info);

        /* July 2002 fix V2.2.1: end if */
    }
    /* end change */

}
예제 #5
0
/*----< print_info() >------------------------------------------------------*/
static
void print_info(MPI_Info *info_used)
{
    int  i, nkeys;

    MPI_Info_get_nkeys(*info_used, &nkeys);
    printf("MPI File Info: nkeys = %d\n",nkeys);
    for (i=0; i<nkeys; i++) {
        char key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL];
        int  valuelen, flag;

        MPI_Info_get_nthkey(*info_used, i, key);
        MPI_Info_get_valuelen(*info_used, key, &valuelen, &flag);
        MPI_Info_get(*info_used, key, valuelen+1, value, &flag);
        printf("MPI File Info: [%2d] key = %25s, value = %s\n",i,key,value);
    }
}
예제 #6
0
void ADIOI_GRIDFTP_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
{

    if (!(fd->info))
	{
	    if ( users_info==MPI_INFO_NULL )
		{
		    /* This must be part of the open call. */
		    MPI_Info_create(&(fd->info));
		}
	    else
		{
		    MPI_Info_dup(users_info,&(fd->info));
		}
	}
    else
	{
	    int i,nkeys,valuelen,flag;
	    char key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL];

	    if ( users_info!=MPI_INFO_NULL )
		{
		    MPI_Info_get_nkeys(users_info,&nkeys);
		    for (i=0;i<nkeys;i++)
			{
			    MPI_Info_get_nthkey(users_info,i,key);
			    MPI_Info_get_valuelen(users_info,key,&valuelen,&flag);
			    if (flag)
				{
				    ADIOI_Info_get(users_info,key,valuelen,value,&flag);
				    if (flag) ADIOI_Info_set(fd->info,key,value);
				}
			}
		}
	}

    /* let the generic ROMIO and MPI-I/O stuff happen... */
    ADIOI_GEN_SetInfo(fd, users_info, error_code);
}
예제 #7
0
/**
 * Get the hint information from the MPI_Info variable stored in the
 * test_params and print it out.
 *
 * @param test_params_p Pointer to test_params. 
 * @return              0 on success.
 */
static int print_hints(struct test_params_s *test_params_p)
{
    int i, hint_key_len, hint_val_len, hint_nkeys, flag;
    char hint_key[MPI_MAX_INFO_KEY], *hint_val;
    
    MPI_Info_get_nkeys(*(test_params_p->info_p), &hint_nkeys);
    for (i = 0; i < hint_nkeys; i++)
    {
        MPI_Info_get_nthkey(*(test_params_p->info_p), i, hint_key);
        hint_key_len = strlen(hint_key);
        MPI_Info_get_valuelen(*(test_params_p->info_p), hint_key,
                              &hint_val_len, &flag);
        assert(flag);
	
        hint_val = malloc((hint_val_len + 1)*sizeof(char));
        if (!hint_val)
        {
            fprintf(stderr, "hint_val malloc of size %d failed.\n",
		    hint_val_len);
            return -1;
        }

        MPI_Info_get(*(test_params_p->info_p), hint_key,
                     hint_val_len + 1, hint_val, &flag);
        assert(flag);
        fprintf(
            stdout,
            "hint %d \"%30s\" = %s\n",
            i, hint_key, hint_val);
        free(hint_val);
    }
    if (!hint_nkeys)
        fprintf(
	    stdout,
            "hints                                   = N/A\n");

    return 0;
}
예제 #8
0
void mpi_info_get_valuelen(int* info, char *key, int *valuelen, int *flag, int* ierr){
  *ierr = MPI_Info_get_valuelen(*info, key, valuelen, flag);
}