本文整理汇总了C++中MPI_Info_free函数的典型用法代码示例。如果您正苦于以下问题:C++ MPI_Info_free函数的具体用法?C++ MPI_Info_free怎么用?C++ MPI_Info_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MPI_Info_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
MPI_Info i1, i2;
int errs = 0;
char value[64];
int flag;
MTest_Init(&argc, &argv);
MPI_Info_create(&i1);
MPI_Info_create(&i2);
MPI_Info_set(i1, (char *) "key1", (char *) "value1");
MPI_Info_set(i2, (char *) "key2", (char *) "value2");
MPI_Info_get(i1, (char *) "key2", 64, value, &flag);
if (flag) {
printf("Found key2 in info1\n");
errs++;
}
MPI_Info_get(i1, (char *) "key1", 64, value, &flag);
if (!flag) {
errs++;
printf("Did not find key1 in info1\n");
} else if (strcmp(value, "value1")) {
errs++;
printf("Found wrong value (%s), expected value1\n", value);
}
MPI_Info_free(&i1);
MPI_Info_free(&i2);
MTest_Finalize(errs);
return MTestReturnValue(errs);
}
示例2: main
int main(int argc, char *argv[]) {
int thread_support;
char root_path[MPI_PMEM_MAX_ROOT_PATH];
MPI_Info info;
MPI_Win_pmem win;
char *window_name = "test_window";
char *win_data;
MPI_Aint win_size = 1024;
int error_code;
int result = 0;
MPI_Init_thread_pmem(&argc, &argv, MPI_THREAD_MULTIPLE, &thread_support);
sprintf(root_path, "%s/0", argv[1]);
MPI_Win_pmem_set_root_path(root_path);
// Allocate window.
MPI_Info_create(&info);
MPI_Info_set(info, "pmem_is_pmem", "true");
MPI_Info_set(info, "pmem_name", window_name);
MPI_Info_set(info, "pmem_mode", "checkpoint");
MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
error_code = MPI_Win_allocate_pmem(win_size, 1, info, MPI_COMM_WORLD, &win_data, &win);
MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);
MPI_Info_free(&info);
if (error_code != MPI_ERR_PMEM_NAME) {
mpi_log_error("Error code is %d, expected %d.", error_code, MPI_ERR_PMEM_NAME);
result = 1;
}
MPI_Finalize_pmem();
return result;
}
示例3: main
int main(int argc, char* argv[])
{
MPI_Init(&argc,&argv);
MPI_Aint bytes = (argc>1) ? atol(argv[1]) : 128*1024*1024;
printf("bytes = %zu\n", bytes);
MPI_Comm comm_shared = MPI_COMM_NULL;
MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0 /* key */, MPI_INFO_NULL, &comm_shared);
MPI_Info info_win = MPI_INFO_NULL;
MPI_Info_create(&info_win);
MPI_Info_set(info_win, "alloc_shared_noncontig", "true");
MPI_Win win_shared = MPI_WIN_NULL;
void * base_ptr = NULL;
int rc = MPI_Win_allocate_shared(bytes, 1 /* disp_unit */, info_win, comm_shared, &base_ptr, &win_shared);
memset(base_ptr,255,bytes);
MPI_Info_free(&info_win);
MPI_Comm_free(&comm_shared);
MPI_Finalize();
return 0;
}
示例4: serverWinCreate
static void
serverWinCreate(void)
{
int ranks[1], modelID;
MPI_Comm commCalc = commInqCommCalc ();
MPI_Group groupCalc;
int nProcsModel = commInqNProcsModel ();
MPI_Info no_locks_info;
xmpi(MPI_Info_create(&no_locks_info));
xmpi(MPI_Info_set(no_locks_info, "no_locks", "true"));
xmpi(MPI_Win_create(MPI_BOTTOM, 0, 1, no_locks_info, commCalc, &getWin));
/* target group */
ranks[0] = nProcsModel;
xmpi ( MPI_Comm_group ( commCalc, &groupCalc ));
xmpi ( MPI_Group_excl ( groupCalc, 1, ranks, &groupModel ));
rxWin = xcalloc((size_t)nProcsModel, sizeof (rxWin[0]));
size_t totalBufferSize = collDefBufferSizes();
rxWin[0].buffer = (unsigned char*) xmalloc(totalBufferSize);
size_t ofs = 0;
for ( modelID = 1; modelID < nProcsModel; modelID++ )
{
ofs += rxWin[modelID - 1].size;
rxWin[modelID].buffer = rxWin[0].buffer + ofs;
}
xmpi(MPI_Info_free(&no_locks_info));
xdebug("%s", "created mpi_win, allocated getBuffer");
}
示例5: MPI_Info_create
void *mpp_alloc (size_t len)
{
MPI_Info info;
void *buf = NULL;
#if HAVE_MPI_ALLOC_MEM
if (use_mpi_alloc) {
MPI_Info_create (&info);
#if 0
MPI_Info_set (info, "alignment", "4096");
MPI_Info_set (info, "type", "private");
#endif
MPI_Alloc_mem (len, info, &buf);
MPI_Info_free (&info);
} else
#endif
buf = malloc(len);
if (buf == NULL) {
fprintf (stderr, "Could not allocate %d byte buffer\n", len);
MPI_Abort (MPI_COMM_WORLD, -1);
}
return buf;
}
示例6: mpi_info_free_
void mpi_info_free_(MPI_Fint *info, int *ierr )
{
MPI_Info info_c;
info_c = MPI_Info_f2c(*info);
*ierr = MPI_Info_free(&info_c);
*info = MPI_Info_c2f(info_c);
}
示例7: main
int main(int argc, char **argv)
{
int rank;
MPI_Info info_in, info_out;
int errors = 0, all_errors = 0;
MPI_Comm comm;
char __attribute__((unused)) invalid_key[] = "invalid_test_key";
char buf[MPI_MAX_INFO_VAL];
int flag;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Info_create(&info_in);
MPI_Info_set(info_in, invalid_key, (char *) "true");
MPI_Comm_dup(MPI_COMM_WORLD, &comm);
MPI_Comm_set_info(comm, info_in);
MPI_Comm_get_info(comm, &info_out);
MPI_Info_get(info_out, invalid_key, MPI_MAX_INFO_VAL, buf, &flag);
#ifndef USE_STRICT_MPI
/* Check if our invalid key was ignored. Note, this check's MPICH's
* behavior, but this behavior may not be required for a standard
* conforming MPI implementation. */
if (flag) {
printf("%d: %s was not ignored\n", rank, invalid_key);
errors++;
}
#endif
MPI_Info_free(&info_in);
MPI_Info_free(&info_out);
MPI_Comm_free(&comm);
MPI_Reduce(&errors, &all_errors, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
if (rank == 0 && all_errors == 0)
printf(" No Errors\n");
MPI_Finalize();
return 0;
}
示例8: main
int main(int argc, char ** argv)
{
MPI_Info info = MPI_INFO_NULL;
MPI_File fh;
MPI_Offset off=0;
MPI_Status status;
int errcode;
int i, rank, errs=0, toterrs, buffer[BUFSIZE], buf2[BUFSIZE];
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Info_create(&info);
MPI_Info_set(info, "romio_cb_write", "enable");
MPI_Info_set(info, "cb_nodes", "1");
for (i=0; i<BUFSIZE; i++) {
buffer[i] = 10000+rank;
}
off = rank*sizeof(buffer);
errcode = MPI_File_open(MPI_COMM_WORLD, argv[1],
MPI_MODE_WRONLY|MPI_MODE_CREATE, info, &fh);
if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open");
errcode = MPI_File_write_at_all(fh, off, buffer, BUFSIZE,
MPI_INT, &status);
if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_write_at_all");
errcode = MPI_File_close(&fh);
if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_close");
errcode = MPI_File_open(MPI_COMM_WORLD, argv[1],
MPI_MODE_RDONLY, info, &fh);
if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_open");
errcode = MPI_File_read_at_all(fh, off, buf2, BUFSIZE,
MPI_INT, &status);
if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_read_at_all");
errcode = MPI_File_close(&fh);
if (errcode != MPI_SUCCESS) handle_error(errcode, "MPI_File_close");
for (i=0; i<BUFSIZE; i++) {
if (buf2[i] != 10000+rank)
errs++;
}
MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
if (rank == 0) {
if( toterrs > 0) {
fprintf( stderr, "Found %d errors\n", toterrs );
}
else {
fprintf( stdout, " No Errors\n" );
}
}
MPI_Info_free(&info);
MPI_Finalize();
return 0;
}
示例9: dump_mpi_file_info
static void dump_mpi_file_info( MPI_File f, const char * prefix = NULL ) {
MPI_Info info;
MPI_CHECK( MPI_File_get_info( f, &info ) );
dump_mpi_info( info, prefix );
MPI_CHECK( MPI_Info_free( &info ) );
}
示例10: main
int
main( int argc, char *argv[] ) {
int nproc = 1, rank = 0;
char *target = NULL;
int c;
MPI_Info info;
int mpi_ret;
int corrupt_blocks = 0;
MPI_Init( &argc, &argv );
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if( (mpi_ret = MPI_Info_create(&info)) != MPI_SUCCESS) {
if(rank == 0) fatal_error( mpi_ret, NULL, "MPI_info_create.\n");
}
prog = strdup( argv[0] );
while( ( c = getopt( argc, argv, "df:h" ) ) != EOF ) {
switch( c ) {
case 'd':
debug = 1;
break;
case 'f':
target = strdup( optarg );
break;
case 'h':
set_hints( &info );
break;
default:
Usage( __LINE__ );
}
}
if ( ! target ) {
Usage( __LINE__ );
}
write_file( target, rank, &info );
read_file( target, rank, &info, &corrupt_blocks );
corrupt_blocks = reduce_corruptions( corrupt_blocks );
if ( rank == 0 ) {
if (corrupt_blocks == 0) {
fprintf(stdout, " No Errors\n");
} else {
fprintf(stdout, "%d/%d blocks corrupt\n",
corrupt_blocks, nproc * NUM_OBJS );
}
}
MPI_Info_free(&info);
MPI_Finalize();
free(prog);
exit( 0 );
}
示例11: win_info_set
static void win_info_set(MPI_Win win, const char *key, const char *set_val)
{
MPI_Info info_in = MPI_INFO_NULL;
MPI_Info_create(&info_in);
MPI_Info_set(info_in, key, set_val);
MPI_Win_set_info(win, info_in);
MPI_Info_free(&info_in);
}
示例12: ADIO_End
void ADIO_End(int *error_code)
{
ADIOI_Flatlist_node *curr, *next;
ADIOI_Datarep *datarep, *datarep_next;
/* FPRINTF(stderr, "reached end\n"); */
/* if a default errhandler was set on MPI_FILE_NULL then we need to ensure
* that our reference to that errhandler is released */
/* Open MPI: The call to PMPI_File_set_errhandler has to be done in romio/src/io_romio_file_open.c
in routine mca_io_romio_file_close()
*/
#if 0
PMPI_File_set_errhandler(MPI_FILE_NULL, MPI_ERRORS_RETURN);
#endif
/* delete the flattened datatype list */
curr = ADIOI_Flatlist;
while (curr) {
if (curr->blocklens) ADIOI_Free(curr->blocklens);
if (curr->indices) ADIOI_Free(curr->indices);
next = curr->next;
ADIOI_Free(curr);
curr = next;
}
ADIOI_Flatlist = NULL;
/* free file and info tables used for Fortran interface */
if (ADIOI_Ftable) ADIOI_Free(ADIOI_Ftable);
#ifndef HAVE_MPI_INFO
if (MPIR_Infotable) ADIOI_Free(MPIR_Infotable);
#endif
/* free the memory allocated for a new data representation, if any */
datarep = ADIOI_Datarep_head;
while (datarep) {
datarep_next = datarep->next;
ADIOI_Free(datarep->name);
ADIOI_Free(datarep);
datarep = datarep_next;
}
if( ADIOI_syshints != MPI_INFO_NULL)
MPI_Info_free(&ADIOI_syshints);
MPI_Op_free(&ADIO_same_amode);
*error_code = MPI_SUCCESS;
}
示例13: IMB_print_info
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 */
}
示例14: ncmpio_free_NC
/*----< ncmpio_free_NC() >----------------------------------------------------*/
void
ncmpio_free_NC(NC *ncp)
{
if (ncp == NULL) return;
ncmpio_free_NC_dimarray(&ncp->dims);
ncmpio_free_NC_attrarray(&ncp->attrs);
ncmpio_free_NC_vararray(&ncp->vars);
if (ncp->mpiinfo != MPI_INFO_NULL) MPI_Info_free(&ncp->mpiinfo);
if (ncp->get_list != NULL) NCI_Free(ncp->get_list);
if (ncp->put_list != NULL) NCI_Free(ncp->put_list);
if (ncp->abuf != NULL) NCI_Free(ncp->abuf);
if (ncp->path != NULL) NCI_Free(ncp->path);
NCI_Free(ncp);
}
示例15: main
int main(int argc, char * argv[])
{
MPI_Init(&argc, &argv);
int wrank, wsize;
MPI_Comm_rank(MPI_COMM_WORLD, &wrank);
MPI_Comm_size(MPI_COMM_WORLD, &wsize);
int nrank, nsize;
MPI_Comm MPI_COMM_NODE;
MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0 /* key */, MPI_INFO_NULL, &MPI_COMM_NODE);
MPI_Comm_rank(MPI_COMM_NODE, &nrank);
MPI_Comm_size(MPI_COMM_NODE, &nsize);
int * shptr = NULL;
MPI_Win shwin;
MPI_Info win_info;
MPI_Info_create(&win_info);
MPI_Info_set(win_info, "alloc_shared_noncontig", "true");
MPI_Win_allocate_shared(sizeof(int), sizeof(int), win_info, MPI_COMM_NODE, &shptr, &shwin);
MPI_Info_free(&win_info);
MPI_Win_lock_all(0 /* assertion */, shwin);
MPI_Win_sync(shwin);
MPI_Barrier(MPI_COMM_NODE);
MPI_Aint rsize[nsize];
int rdisp[nsize];
int * rptr[nsize];
for (int i=0; i<nsize; i++) {
MPI_Win_shared_query(shwin, i, &(rsize[i]), &(rdisp[i]), &(rptr[i]));
printf("rank=%d target=%d rptr=%p rsize=%zu rdisp=%d \n", nrank, i, rptr[i], (size_t)rsize[i], rdisp[i]);
}
MPI_Win_unlock_all(shwin);
MPI_Win_free(&shwin);
MPI_Comm_free(&MPI_COMM_NODE);
MPI_Finalize();
return 0;
}