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

📄 buildiface

📁 mpi并行计算的c++代码 可用vc或gcc编译通过 可以用来搭建并行计算试验环境
💻
📖 第 1 页 / 共 5 页
字号:
		'st' => MPI_Status,		'info' => MPI_Info,		'win' => MPI_Win,		'file' => MPI_File,		'except' => 'int', );## fullclassname gives the C++ binding class name for each shorthand version%fullclassname = ( 'comm' => 'Comm',		   'cart' => 'Cartcomm',		   'dtype' => 'Datatype',		   'errh' => 'Errhandler',		   'graph' => 'Graphcomm',		   'group' => 'Group',		   'null'  => 'Nullcomm',		   'inter' => 'Intercomm',		   'intra' => 'Intracomm',		   'op' => 'Op',		   'preq' => 'Prequest',		   'req' => 'Request',		   'st' => 'Status',		   'greq' => 'Grequest',		   'info' => 'Info',		   'win' => 'Win',		   'file' => 'File',		   'except' => 'Exception',);## Each class may need to access internal elements of another class.# This has gives the list of friends for each class (i.e., the# classes that are allowed to directly access the protected members).# The friends are the full class names%class_friends = ( 'comm' => 'Cartcomm,Intercomm,Intracomm,Graphcomm,Nullcomm,Datatype,Win,File',		   'cart' => '',		   'dtype' => 'Comm,Status,Intracomm,Intercomm,Win,File',		   'errh' => 'Comm,File,Win',		   'graph' => '',		   'group' => 'Comm,Intracomm,Intercomm,Win,File',		   'inter' => 'Intracomm',		   'intra' => 'Cartcomm,Graphcomm,Datatype',		   # Op adds comm as a friend because of MPI2		   'op' => 'Intracomm,Intercomm,Win,Comm',		   'preq' => '',		   'req' => 'Comm,File,Grequest',		   'st' => 'Comm,File,Request',		   'greq' => '',		   'info' => 'File,Win,Comm,Intracomm',		   'win' => '',		   'file' => '', );## We also need to know the derived classes.  This gives the class that# a class is derived from.  Base classes are not included here.%derived_class = ( 'graph' => 'Intracomm', 		   'preq' => 'Request',		   'greq' => 'Request',		   'null' => 'Comm',		   'inter' => 'Comm',		   'intra' => 'Comm',		   'cart' => 'Intracomm',		   );## Maps all of the derived classes to their ultimate parent.  This is# used to find the name of the correct protected element (the_real_xxx),# used to store the C version of the class handle.%mytopclass = ( 'graph'     => 'comm', 		'graphcomm' => 'comm',		'nullcomm'  => 'comm',	        'intracomm' => 'comm', 	        'intercomm' => 'comm',	        'intra'     => 'comm', 	        'inter'     => 'comm',	        'cart'      => 'comm',		'cartcomm'  => 'comm',		'grequest'  => 'request',		'prequest'  => 'request',	        'greq'      => 'request',  	        'preq'      => 'request' );## Many of the C++ binding names are easily derived from the C name.# For those names that are not so derived, this hash provides a mapping from# the C names to the C++ names.# WARNING: This list is incomplete## These have the form <short-class-name>-<C++name> => <C-name>; i.e.,# MPI_Comm_rank becomes 'comm-rank'.  Routines that are part of the MPI# namespace but not in any class leave the class field blank, i.e., # -Attach_buffer .%altname = ( 'base-Attach_buffer' => 'Buffer_attach',	     'base-Detach_buffer' => 'Buffer_detach',	     'base-Compute_dims' => 'Dims_create',	     'base-Get_error_class' => 'Error_class',	     'base-Get_error_string' => 'Error_string',	     'base-Is_initialized' => 'Initialized',	     'base-Is_finalized' => 'Finalized',	     'base-Register_datarep' => 'Register_datarep',	     'comm-Sendrecv_replace' => 'Sendrecv_replace',	     'comm-Get_topology' => 'Topo_test',	     'comm-Get_rank' => 'Comm_rank',	     'comm-Get_size' => 'Comm_size',	     'comm-Get_group' => 'Comm_group',	     'comm-Is_inter' => 'Comm_test_inter',	     'dtype-Create_contiguous' => 'Type_contiguous',	     'dtype-Create_vector' => 'Type_vector',	     'dtype-Create_indexed' => 'Type_indexed',	     'dtype-Create_indexed_block' => 'Type_create_indexed_block',	     'dtype-Create_struct' => 'Type_create_struct',	     'dtype-Get_envelope' => 'Type_get_envelope',	     'dtype-Get_contents' => 'Type_get_contents',	     'dtype-Match_size' => 'Type_match_size',	     'dtype-Create_f90_real' => 'Type_create_f90_real',	     'dtype-Create_f90_complex' => 'Type_create_f90_complex',	     'dtype-Create_f90_integer' => 'Type_create_f90_integer',	     'dtype-Commit' => 'Type_commit',	     'dtype-Pack' => 'Pack',#	     'dtype-Unpack' => 'Unpack',# Unpack is a special case because the C++ binding doesn't follow a simple# rule to derive from the C binding	     'dtype-Pack_size' => 'Pack_size',	     'dtype-Free' => 'Type_free',	     'dtype-Get_size' => 'Type_size',	     'dtype-Get_name' => 'Type_get_name',	     'dtype-Set_name' => 'Type_set_name',	     'dtype-Get_extent' => 'Type_get_extent',	     'dtype-Dup' => 'Type_dup',	     'dtype-Create_subarray' => 'Type_create_subarray',	     'dtype-Create_resized' => 'Type_create_resized',	     'dtype-Create_hvector' => 'Type_create_hvector',	     'dtype-Create_darray' => 'Type_create_darray',	     'dtype-Create_hindexed' => 'Type_create_hindexed',	     'dtype-Get_true_extent' => 'Type_get_true_extent',	     'dtype-Get_attr' => 'Type_get_attr',	     'dtype-Set_attr' => 'Type_set_attr',	     'dtype-Delete_attr' => 'Type_delete_attr',	     'dtype-Free_keyval' => 'Type_free_keyval',	     'group-Get_size' => 'Group_size',	     'group-Get_rank' => 'Group_rank',	     'group-Intersect' => 'Group_intersection',	     'intra-Create_intercomm' => 'Intercomm_create',	     'inter-Create' => 'Comm_create',	     'inter-Split' => 'Comm_split',	     'intra-Split' => 'Comm_split',	     'inter-Get_remote_group' => 'Comm_remote_group',	     'inter-Get_remote_size' => 'Comm_remote_size',	     'inter-Dup' => 'Comm_dup',	     'intra-Create' => 'Comm_create',	     'intra-Dup' => 'Comm_dup',	     'intra-Split' => 'Comm_split',	     'intra-Create_cart' => 'Cart_create',	     'intra-Create_graph' => 'Graph_create',	     'intra-Connect' => 'Comm_connect',	     'intra-Spawn' => 'Comm_spawn',	     'intra-Spawn_multiple' => 'Comm_spawn_multiple',	     'intra-Accept' => 'Comm_accept',	     'st-Is_cancelled' => 'Test_cancelled',	     'cart-Get_cart_rank' => 'Cart_rank',	     'cart-Map' => 'Cart_map',	     'cart-Get_topo' => 'Cart_get',	     'cart-Shift' => 'Cart_shift',	     'cart-Sub' => 'Cart_sub',	     'cart-Dup' => 'Comm_dup',	     'cart-Get_dim' => 'Cartdim_get',	     'cart-Get_coords' => 'Cart_coords',	     'cart-Get_rank' => 'Cart_rank',	     'graph-Map' => 'Graph_map',	     'graph-Get_topo' => 'Graph_get',	     'graph-Get_neighbors' => 'Graph_neighbors',	     'graph-Get_neighbors_count' => 'Graph_neighbors_count',	     'graph-Get_dims' => 'Graphdims_get',	     'graph-Dup' => 'Comm_dup',	     );# These routines must be defered because their implementations need # definitions of classes that must be made later than the class that they# are in.  In particular, these need both datatypes and communicators.%defer_definition = ( 'Pack' => Datatype, 		      'Pack_size' => Datatype, 		      'Unpack' => Datatype		      );# These classes (in the binding name) do not have a compare operation, or # use the parent class's compare operation.# These use the Full class name.%class_has_no_compare = ( 'Status' => 1,			  'Intracomm' => 1,			  'Intercomm' => 1,			  'Nullcomm' => 1,			  'Cartcomm' => 1,			  'Graphcomm' => 1,			  'Prequest' => 1,			  );# These classes do not have a default intialization# These use the Full class name%class_has_no_default = ( 'Status' => 1 );# Read the function specification (will eventually replace the hard-coded# values set in this file).  This file contains information that is not# derived from the ReadInterfaceif ($doFuncspec) {    &ReadFuncSpec( "cxxdecl3.dat" );    # Use the MPI C++ binding names for the defered definitions    $defer_definition{"Create_cart"}  = "Comm";    $defer_definition{"Create_graph"} = "Comm";    $defer_definition{"Get_parent"}   = "Comm";    $defer_definition{"Join"}         = "Comm";    $defer_definition{"Merge"}        = "Intercomm";}# FIXME: TODO# Some of the routine definitions require future class definitions; e.g.,# The Intracomm routine Create_cart needs to create a Cartcomm.  These# routines must have their definitions in initcxx.cxx, not # mpicxx.h .  How should we mark these?# (The original buildiface incorrectly generated Comm objects for these)# Because there are only a few routines, we can keep track of these here# create the master file$filename = "mpicxx.h.in";$OUTFD = OUTFILEHANDLE;open ( $OUTFD, ">${filename}.new" ) || die "Could not open ${filename}.new\n";# Use the derived file as a source$files[$#files+1] = "mpicxx.h";&print_header;&printDefineChecks;&printCoverageHeader( $OUTFD, 1 );print $OUTFD "namespace MPI {\n";print $OUTFD "#if \@HAVE_CXX_EXCEPTIONS\@#define MPIX_CALL( fnc ) \\{int err; err = fnc ; if (err) throw Exception(err);}#else#define MPIX_CALL( fnc ) (void)fnc#endif\n";## Within a "namespace" qualifier, the namespace name should not be used.# Thus, we use Offset, not MPI::Offset.print $OUTFD "// Typedefs for basic int typestypedef MPI_Offset Offset;typedef MPI_Aint   Aint;typedef MPI_Fint   Fint;// Forward class declarationsclass Comm;class Nullcomm;class Intercomm;class Intracomm;class Cartcomm;class Graphcomm;\n";## Add the base routines.  Since these are not in any class, we# place only their prototype in the header file.  The # implementation is then placed in the source file.  We can# put these here because none of them use any of the other classes,# and we'll want to use a few of them in the implementations of the# other functions.foreach $routine (keys(%class_mpi1base)) {    # These aren't really a class, so they don't use Begin/EndClass    $arginfo = $class_mpi1base{$routine};    print $OUTFD "extern ";    &PrintRoutineDef( $OUTFD, "base", $routine, $arginfo, 1 );}# mpi2base adds a few routines which need definitions (Info), so# all of them are at the end, right before the extern declarations## Here's the loop structure# foreach class #   output class header#   for mpi1, mpi2#      for the routines in that class and choice of mpi1, mpi2#   output any special methods## Build the routines by classforeach $class (@classes) {    $shortclass = $class;    $Class = $fullclassname{$class};    #$mpi_type = $class_type{$class};    # Special case to skip over the file routines (whose prototypes cause    # us some problems).    if ($class eq "file") {        if (!$build_io) { next; }	# Add a definition for MPI_FILE_NULL and MPI_File if none available	print $OUTFD "#ifndef MPI_FILE_NULL\#define MPI_FILE_NULL 0\typedef int MPI_File;\#endif\n";    }        # Begin the class, writing the common operations (destructors etc.)    &BeginClass( $class );    # Hack to ifdef out the file routines    if ($class eq "file") {	# Define the file type only if supported.	print $OUTFD "#ifdef MPI_MODE_RDONLY\n";    }    foreach $mpilevel (@mpilevels) {        $mpiclass = "$mpilevel$class";        $class_hash = "class_$mpiclass";	foreach $routine (keys(%$class_hash)) {	    print STDERR "processing $routine\n" if $gDebug;	    # info describes the return parameter and any special	    # processing for this routine.	    $arginfo = $$class_hash{$routine};	    	    &PrintRoutineDef( $OUTFD, $class, $routine, $arginfo, 0 );	    	    # Check for Status as an arg (handle MPI_STATUS_IGNORE 	    # by providing a definition without using Status).	    if ($args =~ /Status/ && $class ne "st") {		&PrintRoutineDefNoStatus( $OUTFD, $class, 					  $routine, $arginfo, 0 ); 	    }	}    }    if (defined($class_extra_fnc{$class})) {	$extrafnc = $class_extra_fnc{$class};	&$extrafnc( $OUTFD );    }    # Hack to ifdef out the file routines    if ($class eq "file") {	# Define the file type only if supported.	print $OUTFD "#endif\n";    }    &EndClass;    # Special case.  Once we define a Datatype, add this typedef    if ($class eq "dtype") {        print $OUTFD "    typedef void User_function(const void *, void*, int, const Datatype&); ";    }}    # Add a few more external functions (some require the above definitions)    foreach $routine (keys(%class_mpi2base)) {        # These aren't really a class, so they don't use Begin/EndClass        $arginfo = $class_mpi2base{$routine};        print $OUTFD "extern ";	#print "$routine - $arginfo\n";        &PrintRoutineDef( $OUTFD, "base", $routine, $arginfo, 1 );    }    # Special case: the typedefs for the datarep function    # Only define these typedefs when MPI-IO is available (this is the same    # test as used for the rest of the I/O routines );print $OUTFD "\#ifdef MPI_MODE_RDONLYtypedef int Datarep_extent_function( const Datatype&, Aint&, void *);typedef int Datarep_conversion_function( void *, Datatype &, int, void *,                Offset, void * );#endif\n";    print $OUTFD "\n";    # Print the extern names for the various constants defined in the     # MPI namespace    &PrintConstants( $OUTFD, 0 );    # Other routines    print $OUTFD "extern void Init(void);\n";    print $OUTFD "extern void Init(int &, char **& );\n";    print $OUTFD "extern int Init_thread(int);\n";    print $OUTFD "extern int Init_thread(int &, char **&, int );\n";    print $OUTFD "extern void Finalize(void);\n";    print $OUTFD "extern Aint Get_address( void * );\n";    print $OUTFD "extern double Wtime(void);\n";    print $OUTFD "extern double Wtick(void);\n";    print $OUTFD "} // namespace MPI\n";    close ( $OUTFD );    &ReplaceIfDifferent( $filename, "${filename}.new" );

⌨️ 快捷键说明

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