Interoperability between Runtime and Driver APIs

I write test code with mixing runtime API code with driver API.

void check_cu(CUresult res, std::string info) {
if(res != 0) {
const char* msg;
cuGetErrorName(res, &msg);
std::cout<<info<<" error ocurs : "<< msg <<std::endl;

int main(){
CUcontext cu_context_;
check_cu(cuCtxGetCurrent(&cu_context_), std::to_string(LINE));

CUmodule module;
check_cu(cuModuleLoad(&module,"add.ptx"), std::to_string(__LINE__));

return 0;


error occurs when call cuModuleLoad : CUDA_ERROR_CONTEXT_IS_DESTROYED.

How to use the driver and runtime api correctly.