14.09.2014 Views

CASINO manual - Theory of Condensed Matter

CASINO manual - Theory of Condensed Matter

CASINO manual - Theory of Condensed Matter

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

• Evidence <strong>of</strong> testing on serial and parallel machines. Remember that in general only the master<br />

processor should write to the output file. Also, casino is supposed to compile and work on<br />

single-processor machines without an installed MPI (Message Passing Interface) library. Use the<br />

fake comms serial.f90 module supplied both in the utils directory and with the main code<br />

(in general you only need worry about this if you introduce a call to an MPI routine which is<br />

not already used in casino and which has not been ‘faked’).<br />

• If you use MPI calls when doing the parallel bits, try to ensure they are included in the MPI-1<br />

standard since, somewhat unbelievably, there are some computers in the world which claim not<br />

to be able to support the 14-year-old MPI-2 standard. Currently, the only MPI-2 routine used<br />

in casino is MPI GATHER IN PLACE, and PLR has implemented a fake version <strong>of</strong> this in the<br />

comms parallel mpi1.f90 routine which can automatically be used on machines which do not<br />

have an MPI-2 installation (if their <strong>CASINO</strong> ARCH file tells them so).<br />

• Your routine uses the standard casino facilities for handling errors (errstop/errwarn etc.).<br />

These can be found in the run control.f90 module.<br />

• Your routine implements something that we desperately want or is in the TODO list.<br />

A.2.2<br />

Bad things<br />

• We do not sacrifice speed for additional functionality. Think <strong>of</strong> another way to write it if it<br />

slows the code down.<br />

• We do not like to include things unless they are completely general. The development <strong>of</strong> general,<br />

complex electronic structure codes can be set back years by people choosing to implement<br />

functionality which works only for their current project. Nongeneral algorithms tend to get<br />

completely thrown away and re-implemented, which wastes the time <strong>of</strong> both parties. It is not<br />

usually much harder to write a general program than it is to write a specific one (we understand<br />

this is not always true!).<br />

• You should not use any calls to external libraries apart from MPI, BLAS and LAPACK.<br />

• When writing to the output file, the new routines should not write out lots <strong>of</strong> weird arrays<br />

(whose meaning is understood only by the author) in an incredibly scruffy format full <strong>of</strong> spelling<br />

mistakes. In general, be as beautiful and informative as you can when writing to output, or<br />

MDT will just have to make it so (which takes ages). If there are all sorts <strong>of</strong> special cases<br />

which require different output, then so be it—select case and if blocks are very useful in this<br />

regard.<br />

• Prior agreement for modification <strong>of</strong> the code should have been obtained. Unsolicited submissions<br />

are not accepted and can lead to moody lack <strong>of</strong> cooperation on our part.<br />

A.3 Testing and debugging <strong>CASINO</strong><br />

Here is some advice on how to go about testing and debugging casino after you have made some<br />

modifications.<br />

• Type make debug in ~/<strong>CASINO</strong>/src/ in order to compile the code with debugging options set.<br />

The resulting binary can be run by the runscript using runqmc −−debug or runqmc −d.<br />

• The best compilers for debugging on PCs are, in order <strong>of</strong> decreasing preference: NAG, G95 (now<br />

deprecated), GCC, PathScale, Intel. MDT has recently discovered that the Cray compiler is<br />

pretty good too.<br />

• It is a good idea to try running the code using several different compilers on several different<br />

architectures: this maximizes the chance <strong>of</strong> finding problems. There are bugs which require<br />

a combination <strong>of</strong> compilers to locate successfully. Note that you should always test that your<br />

modifications work on parallel computers, if possible.<br />

• If you encounter a problem, try changing options in the input file before looking in the code.<br />

For example, does the problem only occur when a Jastrow factor is used? Does it only occur<br />

when the cusp correction is used? Try to obtain the simplest set <strong>of</strong> circumstances capable <strong>of</strong><br />

reproducing the problem.<br />

215

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!