Skip to content

Commit 6bc88fc

Browse files
committed
initial commit
0 parents  commit 6bc88fc

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>MpiProgramming</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>

makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CC=mpicc
2+
CXX=mpicxx
3+
LINK=mpicxx
4+
CFLAGS=-I.
5+
6+
%.o: %.c
7+
$(CC) -c -o $@ $< $(CFLAGS)
8+
9+
%.o: %.cpp
10+
$(CXX) -c -o $@ $< $(CFLAGS)
11+
12+
all: samplesort seqsort
13+
14+
seqsort: seqsort.o
15+
$(LINK) -o $@ $<
16+
17+
samplesort: samplesort.o
18+
$(LINK) -o $@ $<
19+
#data: data.o
20+
# $(LINK) -o $@ $<
21+
22+
23+
#select: select.o
24+
# $(LINK) -o $@ $<
25+
26+
clean:
27+
rm -f *.o *~ seqsort samplesort

seqsort.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
#include <limits.h>
5+
6+
float values[] = {4,1,10,9,2,5,-1,-9,-2,10000,-0.05,-3,-1.1};
7+
8+
int compare (const void *a, const void *b)
9+
{
10+
float fa = *(const float*) a;
11+
float fb = *(const float*)b;
12+
13+
return (fa>fb)-(fa<fb);
14+
}
15+
16+
int main ()
17+
{
18+
int i;
19+
20+
qsort(values,13,sizeof(float),compare);
21+
22+
for (i=0;i<13;i++)
23+
{
24+
printf("%f,",values[i]);
25+
}
26+
27+
putchar('\n');
28+
29+
printf("Max int %d\n",INT_MAX);
30+
printf("Max long int %lu\n",LONG_MAX);
31+
printf("Max random %lu\n",RAND_MAX);
32+
return 0;
33+
}
34+

0 commit comments

Comments
 (0)