5.5.4 Parallelization

Many of things MathGL do in parallel by default (if MathGL was built with pthread). However, there is function which set the number of threads to be used.

C function: int mgl_set_num_thr (int n)

Set the number of threads to be used by MathGL. If n<1 then the number of threads is set as maximal number of processors (cores). If n=1 then single thread will be used (this is default if pthread was disabled).

Another option is combining bitmap image (taking into account Z-ordering) from different instances of mglGraph. This method is most appropriate for computer clusters when the data size is so large that it exceed the memory of single computer node.

Method on mglGraph: int Combine (const mglGraph &g)
C function: int mgl_combine_gr (HMGL gr, HMGL g)

Combine drawing from instance g with gr (or with this) taking into account Z-ordering of pixels. The width and height of both instances must be the same.

Method on mglGraph: int MPI_Send (int id)
C function: int mgl_mpi_send (HMGL gr, int id)

Send graphical information from node id using MPI. The width and height in both nodes must be the same.

Method on mglGraph: int MPI_Recv (int id)
C function: int mgl_mpi_send (HMGL gr, int id)

Receive graphical information from node id using MPI. The width and height in both nodes must be the same.