Question
Do the following in C: This is the odd-even sort algorithm: void Odd_even_sort( int a[] /* in/out */, int n /* in */) { int
Do the following in C:
This is the odd-even sort algorithm:
void Odd_even_sort(
int a[] /* in/out */,
int n /* in */) {
int phase, i, temp;
for (phase = 0; phase
if (phase % 2 == 0){ /* Even phase */
for (i = 1; i
if (a[i1] > a[i]) {
temp = a[i];
a[i] = a[i1];
a[i1] = temp;
}
} else { /* Odd phase */
for (i = 1; i
if (a[i] > a[i+1]) {
temp = a[i];
a[i] = a[i+1];
a[i+1] = temp;
}
}
} /* Odd even sort */
Here is the PBS Script:
#PBS -l nodes=10:ppn=12,walltime=01:00:00
#PBS -q batch
#PBS -N run_yourname
#PBS -j oe
#PBS -V
#cat $PBS_NODEFILE
cd /home/
for i in 1 2 4 8; do
for j in 1 2 4 8; do
mpiexec -np $i --map-by ppr:$j:node --hostfile $PBS_NODEFILE
done
done
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started