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 Evostar 2015
choose your background Do not look at the screen. See what colour it makes your face.
A Field Guide to Genetic Programming
http://www.gp-field-guide.org.uk/
GP EM Genetic Programming and Evolvable Machines | Home
GP Bibliography The Genetic Programming Bibliography