I'm newbie in ScaLAPACK and I have sobe questions about the possibility of setting the number of processes for a program execution. I have a prototype program that looks like
- Code: Select all
//some work that must be done by only one node
//function that runs internally some scalapack computations
//other work must be done by the original node
//Initialize MPI (or PVM)
//here I think I should write some code in order to inform that the work must be done by a number X or processors
//some BLACS and ScaLAPACK computations
//finalize MPI (or PVM)
The idea is to encapsulate all the MPI (or PVM) and ScaLAPACK et al. code in an individual function that will be called after and before some taskc that must be performed by onlu one process. The reason to encapsulate these code into the individual function is I would like to maintain all the other code in the program free of MPI or PVM code. The, I could compile (via preprocessor variables) the code in 'void funcCompScalapack()' for using ScaLAPACK or classical LAPACK and I could have in only one function the possibility to use normal and distributed code. This can be a bad and/or inefficient idea, but my program is only for pedagogical applications.
The main idea is simple. But here starts the problems. If I write my program using ScaLAPACK MPI version and run it as mpirun -np X ./myprogram automatically the program will use X processes and all code before and after the 'funcCompScalapack()' will be executed by the X processes. If I run with -np 1, only one proccess will be used.
I have asked in the OpenMPI mailing list about and there is no exists any function in order to set dynamically the number of processes to use. The only way to manage my problem consists in detect when the process is the root and then execute the code before and after the 'funcCompScalapack()'. But asking about the process id implies to yse MPI code outside the 'funcCompScalapack()', and I do not want to do this.
MPI has the function MPI_Comm_spawn() but it distributes over a number of processes a precompiled binary, and I want to distribute a piece of code in the original program, not an autonomous binary.
It can be dode easily in OpenMP, but I need to perform it in a distributed memory environment in order to use ScaLAPACK.
So, can be my idea done using ScaLAPACK? What about PVM? Could be done using the ScaLAPACK PVM version?