error: calling a __host__ function("printf") from a __global__ function is not allowed

I know this topic has come up before but since I still fell for it I thought it worth
re-posting the solution: add -arch to the compile command line.
Eg nvcc -arch sm_35 file.cu -o prog

The logic of this is only devices 2.0 or later support printf directly but nvcc defaults
not to the compute level of the device attached to your computer but to 1.0. Ie the
default compute level does not support printf. This is what the error message has spent
the last two days trying to tell me.

The simplePrintf example in the cuda sdk samples has a work round for GPUs eralier than 2.0

                            Bill

    Dr. W. B. Langdon,
    Department of Computer Science,
    University College London
    Gower Street, London WC1E 6BT, UK
    http://www.cs.ucl.ac.uk/staff/W.Langdon/

barracuda_0.7.105 http://seqbarracuda.sourceforge.net/
GI 2015 http://geneticimprovement2015.com/
EuroGP 2015 http://www.evostar.org/2015/cfp_eurogp.php
choose your background http://web4.cs.ucl.ac.uk/staff/W.Langdon/colour_telephone/bgcolor.html
A Field Guide to Genetic Programming
http://www.gp-field-guide.org.uk/
GP EM http://www.springer.com/10710
GP Bibliography http://www.cs.bham.ac.uk/~wbl/biblio/