Compiler Errors: Three Ways to Avoid Them

Technique 1: Compare results of two different compilers

Avoiding compiler errors can be done several ways. If you have access to the source code of your CFD solver, then probably the best way to avoid being burned by compiler errors is to compile the code with two completely different compilers on the same system. Then run the two different executables on the same case. If the results are identical, then you're probably safe from this particular problem.

[Note, however, that some compilers have technology that is licensed from other companies, so, while it is rare, it is remotely possible for two different compilers to produce the same errors.]

Technique 2: Compare results of optimized versus unoptimized executables

If you have access to the source code for your solver, but only have one compiler, then the next best technique is to compile the code once with regular optimization and once with no optimization. Then run the same case with each version and compare results. As the "no optimization" code will probably run pretty slowly, you'll want to pick a small case, but make sure it uses a representative set of code options. If the results are the same, then the optimized version is likely safe to use. If there are compiler errors at a very basic level, however, this strategy may not catch them.

Technique 3: Compare the results of runs on different systems

If you do not have access to the source code, then the situation is a bit more difficult. In some respects you are at the mercy of your vendor's quality control department. You may be able to gain a measure of confidence, however, if you can run the same case on two different computers which have different architectures.

In the "old days" this was easy to do, as most everyone in CFD had access to systems from different vendors with completely different CPUs and running different operating systems. At the same time, CFD software vendors used to provide binaries for multiple computer architectures.

Today, the old RISC based architectures are pretty much gone, and the computational ecosystem is mostly reduced to Apple, MS, or Linux operating systems running on Intel-compatible hardware. Still, you may be able to run a 64bit version of your solver on an appropriate system and compare it to an equivalent result from a 32bit system.

The bottom line

The main point of all this is to run what should be the same algorithms on the same initial data and make sure that the results are the same, regardless of what the underlying hardware or operating system are...or, in this case, regardless of which compiler and compiler options were used to create the executables.

If you are finished learning about avoiding compiler errors, return to the main Verification and Validation page.

Otherwise, you can browse through some of the other topics from the Innovative CFD home page

New! Comments

Have your say about what you just read! Leave a comment in the box below.