Skip to content

Commit

Permalink
minor debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
tureture committed May 7, 2023
1 parent 26bcf7c commit 73399b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions A3/quicksort claude.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <time.h>
#include <unistd.h>
#include <math.h>

// Function to swap two numbers
void swap(double *arr, int i, int j)
{
Expand Down
12 changes: 6 additions & 6 deletions A3/quicksort_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ void par_quicksort(int *array, int n, int pivot_strategy, MPI_Comm comm)
if (rank > size / 2) // Send larger to other processor, 1-8, 2-7, 3-6, 4-5
{
// Send size of small and then the array
MPI_ISend(smaller_size, 1, MPI_INT, rank - size/2, 0, comm)
MPI_ISend(smaller, smaller_size, MPI_INT, rank - size/2, 0, comm);
MPI_Isend(smaller_size, 1, MPI_INT, rank - size/2, 0, comm);
MPI_Isend(smaller, smaller_size, MPI_INT, rank - size/2, 0, comm);

// Receive size of large and then the array
MPI_IRecv(larger_size, 1, MPI_INT, rank - size/2, 0, comm, MPI_STATUS_IGNORE);
MPI_IRecv(larger, smaller_size, MPI_INT, rank - size/2, 0, comm, MPI_STATUS_IGNORE);
MPI_Irecv(larger_size, 1, MPI_INT, rank - size/2, 0, comm, MPI_STATUS_IGNORE);
MPI_Irecv(larger, smaller_size, MPI_INT, rank - size/2, 0, comm, MPI_STATUS_IGNORE);
} else // Send smaller to other processor, 1-2, 2-3, 3-4, 4-5
{
MPI_ISend(larger, larger_size, MPI_INT, rank + size/2, 0, comm);
MPI_IRecv(smaller, smaller_size, MPI_INT, rank + size/2, 0, comm, MPI_STATUS_IGNORE);
MPI_Isend(larger_size, 1, MPI_INT, rank + size/2, 0, comm);
MPI_Irecv(smaller, smaller_size, MPI_INT, rank + size/2, 0, comm, MPI_STATUS_IGNORE);

}

Expand Down

0 comments on commit 73399b4

Please sign in to comment.