I don't have much experience with C++ or MPI currently, so I assume this will be an easy question to answer.
I want to be able to change the number of processes that can work on my array sort for experimentation purposes, but when I try to declare a partial array for my worker to work on, I receive an error stating that the array size variable, PART, needs to be constant.
Is this from how I calculated or parsed it, or from an MPI mechanic?
const int arraySize = 10000
int main(int argc, char ** argv)
{
MPI_Init(&argc, &argv);
int rank;
int size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
const int PART = floor(arraySize / size);
auto start = std::chrono::high_resolution_clock::now(); //start timer
//================================ WORKER PROCESSES ===============================
if (rank != 0)
{
int tmpArray[PART]; //HERE IS MY PROBLEM
MPI_Recv(&tmpArray, PART, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); //recieve data into local initalized array
qsort(&tmpArray[0], PART, sizeof(int), compare); // quick sort
MPI_Send(&tmpArray, PART, MPI_INT, 0, 0, MPI_COMM_WORLD); //send sorted array back to rank 0
}