tags:

views:

43

answers:

2

I have an MPI program that I'm developing on a local computer, but need to run on a remote machine. I used clock() to measure time, but after discovering that it doesn't work well enough on the remote machine (due to a completely different architecture), I replaced a few calls to clock() with MPI_Wtime(), which yielded the required results. The program still runs on both the local and remote machines.

However, I just went and replaced all the other calls to clock() with MPI_Wtime(), and now launching the program on the local machine immediately causes the processes to stop with exit code -1073741819. Even if I put a cout in the very first line of main(), there's no output, so I'm fairly sure it's not a programming fault on my part, but I have no idea what's wrong.

How can changes in the source code cause a program to fail before the changed code (or any code, for that matter) is executed?

A: 

Was that cout flushed by an 'endl' or 'flush' manipulator? If not, the program may have crashed afterwards but you'd never know because the buffered output would be lost.

Amardeep
It was, with an `endl`.
suszterpatt
+4  A: 

Are you calling MPI_Wtime() from the constructor of a static object? These run before main().

Mike Seymour
Yep, this was it.
suszterpatt