User Tools

Site Tools


自作クラスタ計算機:mpiによる並列計算

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
自作クラスタ計算機:mpiによる並列計算 [2020/03/02 16:26]
koudai
自作クラスタ計算機:mpiによる並列計算 [2020/03/02 16:30]
koudai [サンプルプログラム]
Line 36: Line 36:
 <file - test.c> <file - test.c>
 #include <stdio.h> #include <stdio.h>
-#include <mpi.h>+#include "mpi.h"
  
-int main(int argc, char **argv) {+int main( int argc, char *argv[] ) 
 +{
     int     rank, size, len;     int     rank, size, len;
     char    name[MPI_MAX_PROCESSOR_NAME];     char    name[MPI_MAX_PROCESSOR_NAME];
Line 47: Line 48:
     MPI_Get_processor_name( name, &len );     MPI_Get_processor_name( name, &len );
     name[len] = '\0';     name[len] = '\0';
-    printf( "Hello, world! I am %d of %d from %s\n", rank, size, name ); +    printf( "Hello World! I am %d of %d from %s\n", rank, size, name );
-    MPI_Barrier( MPI_COMM_WORLD );+
     MPI_Finalize();     MPI_Finalize();
  
自作クラスタ計算機/mpiによる並列計算.txt · Last modified: 2023/12/26 23:43 by koudai