In this example, Zoltan_Initialize is called using the argc and argv arguments to the main program. Then a pointer to a Zoltan structure is returned by the call to Zoltan_Create. In this example, all processors will be used by Zoltan, as MPI_COMM_WORLD is passed to Zoltan_Create as the communicator.
Several application query functions are then registered with Zoltan through calls to Zoltan_Set_Fn. Parameters are set through calls to Zoltan_Set_Param. The application then performs in computations, including making calls to Zoltan functions and utilities.
Before its execution ends, the application frees memory used by Zoltan by
calling
Zoltan_Destroy.
/* Initialize the Zoltan library
*/
struct Zoltan_Struct *zz; float version; ... Zoltan_Initialize(argc, argv, &version); zz = Zoltan_Create(MPI_COMM_WORLD); /* Register query functions. */
/* Set some Zoltan parameters. */
/* Perform application computations, call Zoltan, etc. */
/* Free Zoltan data structure before ending application. */
|
! Initialize the Zoltan library
type(Zoltan_Struct), pointer :: zz real(Zoltan_FLOAT) version integer(Zoltan_INT) ierr ... ierr = Zoltan_Initialize(version) ! without argc and argv zz => Zoltan_Create(MPI_COMM_WORLD) ! Register load-balancing query functions.
! Set some Zoltan parameters.
! Perform application computations, call Zoltan, etc.
! Free Zoltan data structure before ending application.
|