here is another buggy code raising an exception in Aislinn. The code is wrong because not all the ranks use the same operation in the Reduce.
#include <mpi.h>
#include <stdio.h>
#define buff_size 128
int main(int argc, char **argv) {
int nprocs = -1;
int rank = -1;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
printf("Hello from rank %d \n", rank);
if (nprocs < 2)
printf("MBI ERROR: This test needs at least 2 processes to produce a bug!\n");
MPI_Op op = MPI_SUM;
if (rank % 2)
op = MPI_MAX;
int sum1, val1 = 1;
MPI_Reduce(&sum1, &val1, 1, MPI_INT, op, 0, MPI_COMM_WORLD); /* MBIERROR */
MPI_Finalize();
printf("Rank %d finished normally\n", rank);
return 0;
}
$ aislinn-cc -g /builds/quinson/mbi2/gencodes/CollOpMatching_Reduce_nok.c -o CollOpMatching_Reduce_nok
$ aislinn -p=2 CollOpMatching_Reduce_nok
==AN== INFO: Aislinn v0.5.0
Traceback (most recent call last):
File "/builds/quinson/mbi2/tools/aislinn-git/bin/../src/aislinn/aislinn.py", line 359, in <module>
main()
File "/builds/quinson/mbi2/tools/aislinn-git/bin/../src/aislinn/aislinn.py", line 315, in main
if not generator.run():
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/generator.py", line 195, in run
self.main_cycle()
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/generator.py", line 184, in main_cycle
context.process_run_result(c.finish_async())
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/context.py", line 150, in process_run_result
if self.handle_call(result[1], result[2:]):
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/context.py", line 123, in handle_call
return call.run(self, args)
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/mpicalls.py", line 921, in run
for i in xrange(len(args))])
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/mpicalls.py", line 423, in MPI_Reduce
args)
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/mpicalls.py", line 790, in call_collective_operation
context, comm, op_class, blocking, args)
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/globalstate.py", line 116, in call_collective_operation
op.enter(context, comm, args)
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/collectives.py", line 66, in enter
self.enter_main(context, comm, args)
File "/builds/quinson/mbi2/tools/aislinn-git/src/aislinn/mpi/collectives.py", line 653, in enter_main
self.datatype == datatype)
AssertionError