⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commnames.c

📁 MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程环境.
💻 C
字号:
/* * Check that we can put names on communicators and get them back. */#include <stdio.h>#include "mpi.h"#if defined(NEEDS_STDLIB_PROTOTYPES)#include "protofix.h"#endifint main( int argc, char **argv ){  char commName [MPI_MAX_NAME_STRING+1];  int namelen;  MPI_Init( &argc, &argv );    if (MPI_Comm_get_name(MPI_COMM_WORLD, commName, &namelen) != MPI_SUCCESS)    {      printf("Failed to get a name from COMM_WORLD\n");      MPI_Abort(MPI_COMM_WORLD, -1);    }  if (strcmp("MPI_COMM_WORLD", commName))    {      printf("Name on MPI_COMM_WORLD is \"%s\" should be \"MPI_COMM_WORLD\"\n", commName);      MPI_Abort(MPI_COMM_WORLD, -1);    }    if (namelen != strlen (commName))    {      printf("Length of name on MPI_COMM_WORLD is %d should be %d\n", 	     namelen, (int) strlen(commName));       MPI_Abort(MPI_COMM_WORLD, -1);    }  /* Check that we can replace it */  if (MPI_Comm_set_name(MPI_COMM_WORLD,"foobar") != MPI_SUCCESS)    {      printf("Failed to put a name onto COMM_WORLD\n");      MPI_Abort(MPI_COMM_WORLD, -1);    }  if (MPI_Comm_get_name(MPI_COMM_WORLD, commName, &namelen) != MPI_SUCCESS)    {      printf("Failed to get a name from COMM_WORLD after changing it\n");      MPI_Abort(MPI_COMM_WORLD, -1);    }  if (strcmp("foobar", commName))    {      printf("Name on MPI_COMM_WORLD is \"%s\" should be \"foobar\"\n", 	     commName );      MPI_Abort(MPI_COMM_WORLD, -1);    }  printf("Name tests OK\n");  MPI_Finalize();  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -