strange segmentation fault?

I created a file called kernels.cu containing the code:

#include <stdio.h>
__global__ void kern()
{
    printf("hi!");
}
void k_kern()
{
	printf("starting kernel\n");
	kern<<<1,1>>>();
}

Then i launched it from my class:

#pragma once
void k_kern();
class MyClass
{
    MyClass(){}
    ~MyClass(){}
    void start_kernel()
    {
        k_kern();
    }
};

In the main i do:

#include "MyClass.h"
int main(int argc, char** argv)
{
    MyClass m = MyClass();
    m.start_kernel();
}

Compiling using:

main:
    nvcc -arch=sm_30 -std=c++11 -I /usr/local/cuda-6.5/include -L /usr/local/cuda-6.5/lib64/ -lcuda -lcudart ./main.cpp kernels.o -o prog
kernels:
    nvcc -arch=sm_30 -std=c++11 -c ./src/kernels.cu

Permutations of the code were running but now i get a segmentation fault. Does anyone know what is going wrong here? Might i have messed up the device somehow?

Thanks for you attention.

A segmentation fault is something that occurs in host (CPU) code, usually due to an out-of-bounds access or uninitialized variable.

I see but the segmentation fault occurs exactly after “starting kernel” is printed. If i comment out kern<<<1,1>>>(); the code run’s just fine.

If you want to provide a complete code, in a single file, that I can copy, paste, compile, and run, I’ll take a look at it.

Segmentation fault these days occur too when you prinf something in your OpenCL kernel.
Then some nvidia OpenCL-lib crashes (or does something shady) and this propagates to your host app.