File Makefile changed (mode: 100644) (index 3221e36..f715c36) |
... |
... |
PROGS_BASIC = readbin writebin transposebin matchmtx |
6 |
6 |
PROGS = $(PROGS_BASIC) |
PROGS = $(PROGS_BASIC) |
7 |
7 |
# \ |
# \ |
8 |
8 |
# seqauction parauction parauction_allreduce parauction_allgather parauction_root |
# seqauction parauction parauction_allreduce parauction_allgather parauction_root |
|
9 |
|
MPIPROGS=mpitransposebin mpitransposebin_root \ |
|
10 |
|
parauction parauction_allreduce parauction_allgather parauction_root |
9 |
11 |
|
|
10 |
12 |
.PHONY: all |
.PHONY: all |
11 |
13 |
all: $(PROGS) |
all: $(PROGS) |
|
14 |
|
mpiall: $(MPIPROGS) |
12 |
15 |
|
|
13 |
16 |
readbin: readbin.o libsmut.a |
readbin: readbin.o libsmut.a |
14 |
17 |
writebin: writebin.o libsmut.a |
writebin: writebin.o libsmut.a |
|
... |
... |
cacheblast.o: cacheblast.c |
23 |
26 |
timer.o: timer.c |
timer.o: timer.c |
24 |
27 |
auction.o: auction.c |
auction.o: auction.c |
25 |
28 |
stripesmut.o: stripesmut.c stripesmut.h |
stripesmut.o: stripesmut.c stripesmut.h |
26 |
|
$(MPICC) $(CFLAGS) -c stripesmut.c |
|
|
29 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -c stripesmut.c |
27 |
30 |
redist1: redist1.c stripesmut.o libsmut.a |
redist1: redist1.c stripesmut.o libsmut.a |
28 |
|
$(MPICC) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
|
|
31 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
29 |
32 |
redist2: redist2.c stripesmut.o libsmut.a |
redist2: redist2.c stripesmut.o libsmut.a |
30 |
|
$(MPICC) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
|
|
33 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
31 |
34 |
redist3: redist3.c stripesmut.o libsmut.a |
redist3: redist3.c stripesmut.o libsmut.a |
32 |
|
$(MPICC) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
|
|
35 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
33 |
36 |
redist4: redist4.c stripesmut.o libsmut.a |
redist4: redist4.c stripesmut.o libsmut.a |
34 |
|
$(MPICC) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
|
|
37 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
35 |
38 |
colcomp: colcomp.c stripesmut.o libsmut.a |
colcomp: colcomp.c stripesmut.o libsmut.a |
36 |
|
$(MPICC) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
|
|
39 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
37 |
40 |
mpitransposebin: mpitransposebin.c stripesmut.o libsmut.a |
mpitransposebin: mpitransposebin.c stripesmut.o libsmut.a |
38 |
|
$(MPICC) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
|
|
41 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
39 |
42 |
mpitransposebin_root: mpitransposebin_root.c stripesmut.o libsmut.a |
mpitransposebin_root: mpitransposebin_root.c stripesmut.o libsmut.a |
40 |
|
$(MPICC) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
|
|
43 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $< stripesmut.o libsmut.a $(LDLIBS) |
41 |
44 |
|
|
42 |
45 |
dlamch.o: mc64/dlamch.c |
dlamch.o: mc64/dlamch.c |
43 |
46 |
$(CC) -I. -Imc64/ -c -o $@ $< |
$(CC) -I. -Imc64/ -c -o $@ $< |
|
... |
... |
matchmtx: matchmtx.o auction.o libsmut.a |
59 |
62 |
$(CC) $(FFLAGS) -o $@ $^ $(LDLIBS) |
$(CC) $(FFLAGS) -o $@ $^ $(LDLIBS) |
60 |
63 |
|
|
61 |
64 |
stripe_auction.o: stripe_auction.c stripe_auction.h auction.h smut.h |
stripe_auction.o: stripe_auction.c stripe_auction.h auction.h smut.h |
62 |
|
$(MPICC) $(CFLAGS) -c -o $@ $< |
|
|
65 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
63 |
66 |
parauction.o: parauction.c auction.h smut.h |
parauction.o: parauction.c auction.h smut.h |
64 |
|
$(MPICC) $(CFLAGS) -c -o $@ $< |
|
|
67 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
65 |
68 |
parauction: parauction.o stripe_auction.o stripesmut.o auction.o libsmut.a |
parauction: parauction.o stripe_auction.o stripesmut.o auction.o libsmut.a |
66 |
|
$(MPICC) $(CFLAGS) -o $@ $^ $(LDLIBS) |
|
|
69 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDLIBS) |
67 |
70 |
|
|
68 |
71 |
parauction_allreduce.o: parauction_allreduce.c auction.h smut.h |
parauction_allreduce.o: parauction_allreduce.c auction.h smut.h |
69 |
|
$(MPICC) $(CFLAGS) -c -o $@ $< |
|
|
72 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
70 |
73 |
parauction_allreduce: parauction_allreduce.o stripe_auction.o stripesmut.o auction.o libsmut.a |
parauction_allreduce: parauction_allreduce.o stripe_auction.o stripesmut.o auction.o libsmut.a |
71 |
|
$(MPICC) $(CFLAGS) -o $@ $^ $(LDLIBS) |
|
|
74 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDLIBS) |
72 |
75 |
|
|
73 |
76 |
parauction_allgather.o: parauction_allgather.c auction.h smut.h |
parauction_allgather.o: parauction_allgather.c auction.h smut.h |
74 |
|
$(MPICC) $(CFLAGS) -c -o $@ $< |
|
|
77 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
75 |
78 |
parauction_allgather: parauction_allgather.o stripe_auction.o stripesmut.o auction.o libsmut.a |
parauction_allgather: parauction_allgather.o stripe_auction.o stripesmut.o auction.o libsmut.a |
76 |
|
$(MPICC) $(CFLAGS) -o $@ $^ $(LDLIBS) |
|
|
79 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDLIBS) |
77 |
80 |
|
|
78 |
81 |
parauction_root.o: parauction_root.c auction.h smut.h |
parauction_root.o: parauction_root.c auction.h smut.h |
79 |
|
$(MPICC) $(CFLAGS) -c -o $@ $< |
|
|
82 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
80 |
83 |
parauction_root: parauction_root.o stripe_auction.o stripesmut.o auction.o libsmut.a |
parauction_root: parauction_root.o stripe_auction.o stripesmut.o auction.o libsmut.a |
81 |
|
$(MPICC) $(CFLAGS) -o $@ $^ $(LDLIBS) |
|
|
84 |
|
$(MPICC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDLIBS) |
82 |
85 |
|
|
83 |
86 |
|
|
84 |
87 |
|
|
85 |
88 |
.PHONY: clean |
.PHONY: clean |
86 |
89 |
clean: |
clean: |
87 |
|
rm -f $(PROGS) *.o libmc64.a libsmut.a |
|
|
90 |
|
rm -f $(PROGS) $(MPIPROGS) *.o libmc64.a libsmut.a |
88 |
91 |
|
|
File auction.c changed (mode: 100644) (index e60143f..3c5fff8) |
... |
... |
auction_eval_primal_dual (const struct spcsr_t A, const double *b_in, |
292 |
292 |
*dual_out = dual; |
*dual_out = dual; |
293 |
293 |
} |
} |
294 |
294 |
|
|
295 |
|
void |
|
|
295 |
|
double |
296 |
296 |
auction_eval_gap (const struct spcsr_t A, const double *b_in, |
auction_eval_gap (const struct spcsr_t A, const double *b_in, |
297 |
297 |
const int *match_in, const double *price_in, |
const int *match_in, const double *price_in, |
298 |
298 |
double *gap_out) |
double *gap_out) |
|
... |
... |
auction_eval_gap (const struct spcsr_t A, const double *b_in, |
305 |
305 |
const int * restrict match = match_in; |
const int * restrict match = match_in; |
306 |
306 |
|
|
307 |
307 |
double gap = 0.0; |
double gap = 0.0; |
|
308 |
|
double primal = 0.0; |
308 |
309 |
|
|
309 |
310 |
int i; |
int i; |
310 |
311 |
|
|
|
... |
... |
auction_eval_gap (const struct spcsr_t A, const double *b_in, |
330 |
331 |
} |
} |
331 |
332 |
if (match_p < HUGE_VAL) |
if (match_p < HUGE_VAL) |
332 |
333 |
gap += (match_p + profit) - match_e; |
gap += (match_p + profit) - match_e; |
|
334 |
|
if (!isinf(match_e)) primal += fabs(match_e); |
333 |
335 |
} |
} |
334 |
336 |
|
|
335 |
337 |
*gap_out = gap; |
*gap_out = gap; |
|
338 |
|
return primal; |
336 |
339 |
} |
} |
337 |
340 |
|
|
338 |
341 |
#if 1 |
#if 1 |
File parauction.c changed (mode: 100644) (index e119f57..8f93435) |
... |
... |
main (int argc, char **argv) |
515 |
515 |
int err; |
int err; |
516 |
516 |
|
|
517 |
517 |
double mu_min; |
double mu_min; |
|
518 |
|
int relgap = 0; |
518 |
519 |
|
|
519 |
520 |
struct spcsr_t A, Acopy; |
struct spcsr_t A, Acopy; |
520 |
521 |
struct gcsr_t gA; |
struct gcsr_t gA; |
|
... |
... |
main (int argc, char **argv) |
644 |
645 |
} |
} |
645 |
646 |
} |
} |
646 |
647 |
|
|
647 |
|
mu_min = 1.0; |
|
|
648 |
|
mu_min = 1.0 / A.nr; |
|
649 |
|
if (argc > 2) |
|
650 |
|
mu_min = strtod(argv[2], NULL); |
|
651 |
|
if (argc > 3) |
|
652 |
|
relgap = 1; |
648 |
653 |
|
|
649 |
654 |
lmatch = malloc (lnc * sizeof (int)); |
lmatch = malloc (lnc * sizeof (int)); |
650 |
655 |
lprice = malloc (lnc * sizeof (double)); |
lprice = malloc (lnc * sizeof (double)); |
|
... |
... |
main (int argc, char **argv) |
656 |
661 |
errflg = stripe_auction_simple (&gA, lexpint, lmatch, lprice, mu_min, |
errflg = stripe_auction_simple (&gA, lexpint, lmatch, lprice, mu_min, |
657 |
662 |
&comm_state, MPI_COMM_WORLD); |
&comm_state, MPI_COMM_WORLD); |
658 |
663 |
#else |
#else |
659 |
|
errflg = stripe_auction_scaling (&gA, lexpint, lmatch, lprice, mu_min, |
|
|
664 |
|
errflg = stripe_auction_scaling (&gA, lexpint, lmatch, lprice, |
|
665 |
|
mu_min, relgap, |
660 |
666 |
&comm_state, MPI_COMM_WORLD); |
&comm_state, MPI_COMM_WORLD); |
661 |
667 |
#endif |
#endif |
662 |
668 |
stop_timer(&timer); |
stop_timer(&timer); |
File parauction_allgather.c changed (mode: 100644) (index 63b3b95..b555c01) |
... |
... |
main (int argc, char **argv) |
501 |
501 |
int err; |
int err; |
502 |
502 |
|
|
503 |
503 |
double mu_min; |
double mu_min; |
|
504 |
|
int relgap = 0; |
504 |
505 |
|
|
505 |
506 |
struct spcsr_t A, Acopy; |
struct spcsr_t A, Acopy; |
506 |
507 |
struct gcsr_t gA; |
struct gcsr_t gA; |
|
... |
... |
main (int argc, char **argv) |
630 |
631 |
} |
} |
631 |
632 |
} |
} |
632 |
633 |
|
|
633 |
|
mu_min = 1.0; |
|
|
634 |
|
mu_min = 1.0 / A.nr; |
|
635 |
|
if (argc > 2) |
|
636 |
|
mu_min = strtod(argv[2], NULL); |
|
637 |
|
if (argc > 3) |
|
638 |
|
relgap = 1; |
634 |
639 |
|
|
635 |
640 |
lmatch = malloc (lnc * sizeof (int)); |
lmatch = malloc (lnc * sizeof (int)); |
636 |
641 |
lprice = malloc (lnc * sizeof (double)); |
lprice = malloc (lnc * sizeof (double)); |
|
... |
... |
main (int argc, char **argv) |
642 |
647 |
errflg = stripe_auction_simple (&gA, lexpint, lmatch, lprice, mu_min, |
errflg = stripe_auction_simple (&gA, lexpint, lmatch, lprice, mu_min, |
643 |
648 |
&comm_state, MPI_COMM_WORLD); |
&comm_state, MPI_COMM_WORLD); |
644 |
649 |
#else |
#else |
645 |
|
errflg = stripe_auction_scaling (&gA, lexpint, lmatch, lprice, mu_min, |
|
|
650 |
|
errflg = stripe_auction_scaling (&gA, lexpint, lmatch, lprice, |
|
651 |
|
mu_min, relgap, |
646 |
652 |
&comm_state, MPI_COMM_WORLD); |
&comm_state, MPI_COMM_WORLD); |
647 |
653 |
#endif |
#endif |
648 |
654 |
stop_timer(&timer); |
stop_timer(&timer); |
File parauction_allreduce.c changed (mode: 100644) (index d83e201..af8f84d) |
... |
... |
main (int argc, char **argv) |
320 |
320 |
int err; |
int err; |
321 |
321 |
|
|
322 |
322 |
double mu_min; |
double mu_min; |
|
323 |
|
int relgap = 0; |
323 |
324 |
|
|
324 |
325 |
struct spcsr_t A, Acopy; |
struct spcsr_t A, Acopy; |
325 |
326 |
struct gcsr_t gA; |
struct gcsr_t gA; |
|
... |
... |
main (int argc, char **argv) |
449 |
450 |
} |
} |
450 |
451 |
} |
} |
451 |
452 |
|
|
452 |
|
mu_min = 1.0; |
|
|
453 |
|
mu_min = 1.0 / A.nr; |
|
454 |
|
if (argc > 2) |
|
455 |
|
mu_min = strtod(argv[2], NULL); |
|
456 |
|
if (argc > 3) |
|
457 |
|
relgap = 1; |
453 |
458 |
|
|
454 |
459 |
lmatch = malloc (lnc * sizeof (int)); |
lmatch = malloc (lnc * sizeof (int)); |
455 |
460 |
lprice = malloc (lnc * sizeof (double)); |
lprice = malloc (lnc * sizeof (double)); |
|
... |
... |
main (int argc, char **argv) |
461 |
466 |
errflg = stripe_auction_simple (&gA, lexpint, lmatch, lprice, mu_min, |
errflg = stripe_auction_simple (&gA, lexpint, lmatch, lprice, mu_min, |
462 |
467 |
&comm_state, MPI_COMM_WORLD); |
&comm_state, MPI_COMM_WORLD); |
463 |
468 |
#else |
#else |
464 |
|
errflg = stripe_auction_scaling (&gA, lexpint, lmatch, lprice, mu_min, |
|
|
469 |
|
errflg = stripe_auction_scaling (&gA, lexpint, lmatch, lprice, |
|
470 |
|
mu_min, relgap, |
465 |
471 |
&comm_state, MPI_COMM_WORLD); |
&comm_state, MPI_COMM_WORLD); |
466 |
472 |
#endif |
#endif |
467 |
473 |
stop_timer(&timer); |
stop_timer(&timer); |
File parauction_root.c changed (mode: 100644) (index 751c2b5..0fcea0b) |
... |
... |
main (int argc, char **argv) |
502 |
502 |
int err; |
int err; |
503 |
503 |
|
|
504 |
504 |
double mu_min; |
double mu_min; |
|
505 |
|
int relgap = 0; |
505 |
506 |
|
|
506 |
507 |
struct spcsr_t A, Acopy; |
struct spcsr_t A, Acopy; |
507 |
508 |
struct gcsr_t gA, gAroot; |
struct gcsr_t gA, gAroot; |
|
... |
... |
main (int argc, char **argv) |
635 |
636 |
} |
} |
636 |
637 |
} |
} |
637 |
638 |
|
|
638 |
|
mu_min = 1.0; |
|
|
639 |
|
mu_min = 1.0 / A.nr; |
|
640 |
|
if (argc > 2) |
|
641 |
|
mu_min = strtod(argv[2], NULL); |
|
642 |
|
if (argc > 3) |
|
643 |
|
relgap = 1; |
639 |
644 |
|
|
640 |
645 |
if (am_root) { |
if (am_root) { |
641 |
646 |
price = malloc (gA.nc * sizeof(double)); |
price = malloc (gA.nc * sizeof(double)); |
|
... |
... |
main (int argc, char **argv) |
666 |
671 |
expint, rcounts, rdisps, MPI_DOUBLE, |
expint, rcounts, rdisps, MPI_DOUBLE, |
667 |
672 |
0, comm); |
0, comm); |
668 |
673 |
|
|
669 |
|
errflg = auction_scaling (gAroot.local, expint, match, price, mu_min); |
|
|
674 |
|
errflg = auction_scaling (gAroot.local, expint, match, price, |
|
675 |
|
mu_min, relgap); |
670 |
676 |
/* Don't scatter results, freebie */ |
/* Don't scatter results, freebie */ |
671 |
677 |
stop_timer(&timer); |
stop_timer(&timer); |
672 |
678 |
|
|
File stripe_auction.c changed (mode: 100644) (index d5c7bb4..5ac297a) |
... |
... |
stripe_auction_simple (const struct gcsr_t *gA, const double *lb, |
296 |
296 |
int |
int |
297 |
297 |
stripe_auction_scaling (const struct gcsr_t *gA, const double *lb_in, |
stripe_auction_scaling (const struct gcsr_t *gA, const double *lb_in, |
298 |
298 |
int *lmatch_in, double *lprice_in, |
int *lmatch_in, double *lprice_in, |
299 |
|
const double mu_final, |
|
|
299 |
|
const double mu_final, const int relgap, |
300 |
300 |
struct comm_state_t *comm_state, |
struct comm_state_t *comm_state, |
301 |
301 |
MPI_Comm comm) |
MPI_Comm comm) |
302 |
302 |
{ |
{ |
|
... |
... |
stripe_auction_scaling (const struct gcsr_t *gA, const double *lb_in, |
483 |
483 |
|
|
484 |
484 |
{ |
{ |
485 |
485 |
int j; |
int j; |
|
486 |
|
double pg[2] = {0.0, 0.0}; |
|
487 |
|
double all_pg[2] = {0.0, 0.0}; |
486 |
488 |
|
|
487 |
489 |
pmax = -HUGE_VAL; |
pmax = -HUGE_VAL; |
488 |
|
gap = 0.0; |
|
489 |
|
auction_eval_gap (local, lb, lmatch, lprice, &gap); |
|
|
490 |
|
pg[0] = auction_eval_gap (local, lb, lmatch, lprice, &pg[1]); |
490 |
491 |
/*fprintf (stderr, "%d: pass: %d gap: %g mu: %g\n", rank, pass, gap, mu);*/ |
/*fprintf (stderr, "%d: pass: %d gap: %g mu: %g\n", rank, pass, gap, mu);*/ |
491 |
|
MPI_Allreduce (&gap, &tmp, 1, MPI_DOUBLE, MPI_SUM, comm); |
|
492 |
|
gap = tmp; |
|
|
492 |
|
MPI_Allreduce (pg, all_pg, 2, MPI_DOUBLE, MPI_SUM, comm); |
|
493 |
|
gap = pg[1]; |
|
494 |
|
if (!relgap) { |
|
495 |
|
#if 1 |
|
496 |
|
if (gap < gnc * mu_final) break; /* before clearing match */ |
|
497 |
|
#else |
|
498 |
|
if (gap < mu_final) break; /* before clearing match */ |
|
499 |
|
#endif |
|
500 |
|
} |
|
501 |
|
else { |
|
502 |
|
if (pg[1] / pg[0] < mu_final) break; |
|
503 |
|
} |
493 |
504 |
new_mu = theta * (gap) / gnc; |
new_mu = theta * (gap) / gnc; |
494 |
505 |
if (new_mu < 8.0*mu_final) new_mu = mu_final; |
if (new_mu < 8.0*mu_final) new_mu = mu_final; |
495 |
506 |
if (new_mu > theta * mu) new_mu = theta * mu; |
if (new_mu > theta * mu) new_mu = theta * mu; |
496 |
507 |
|
|
497 |
508 |
/*fprintf (stderr, "%d: pass: %d gap: %g mu: %g\n", rank, pass, gap, mu);*/ |
/*fprintf (stderr, "%d: pass: %d gap: %g mu: %g\n", rank, pass, gap, mu);*/ |
498 |
509 |
|
|
499 |
|
#if 1 |
|
500 |
|
if (gap < gnc * mu_final) break; /* before clearing match */ |
|
501 |
|
#else |
|
502 |
|
if (gap < mu_final) break; /* before clearing match */ |
|
503 |
|
#endif |
|
504 |
|
|
|
505 |
510 |
for (j = 0; j < lnc; ++j) { |
for (j = 0; j < lnc; ++j) { |
506 |
511 |
const int i = lmatch[j]; |
const int i = lmatch[j]; |
507 |
512 |
const double p = lprice[j]; |
const double p = lprice[j]; |