What are the parameters of the __cudaRegisterFatBinary and __cudaRegisterFunction functions?

I came across two functions

__cudaRegisterFatBinary()

and

__cudaRegisterFunction()

I understand that nvcc injects it into the source code to get the compiled cube descriptor and register the program with runtime.

Can someone explain to me or tell me where I can find information on each of the parameters of the functions? in particular, I want to know more about the __cudafatcudabinaryrec pointer used in the first function. And about the host function and device function pointers in the second function.

thanks

+4
source share
2 answers

Prototypes are in cudart.h .

 void** __cudaRegisterFatBinary(void *fatCubin); void __cudaRegisterFunction(void **fatCubinHandle, const char *hostFun, char *deviceFun, const char *deviceName, int thread_limit, uint3 *tid, uint3 *bid, dim3 *bDim, dim3 *gDim, int *wSize); 

But note that these functions are not intended to directly call the user code.

+2
source

I know this is a very old stream, but I just want to share some of my discoveries. I redid some part of the executable file that NVCC generates. Therefore, I am not sure of the correctness and use at my own risk. I am using cuda 8.0 RC, so I'm not sure that other versions have not changed anything.

__cuRegisterFatBinary accepts void * input. It points to an executable file, and in my example I got the following.

B1 43 62 46 01 00 00 00 70 15 40 00 00 00 00 00 00 00 00 00 00 00 00 00

Hex sequence follows format

 struct { uint32_t magic; // Always 0x466243b1 uint32_t seq; // Sequence number of the cubin uint64_t ptr; // The pointer to the real cubin uint64_t data_ptr; // Some pointer related to the data segment } 

So, if you follow the address in the ptr field, you can find a real bold binary file that follows the definition you can find in fatbinary.h in the cuda include directory. There is header information. If you are looking for the next occurrence of 0x7F + 'ELF' (elf magic), you can extract the Cuban file there.

+1
source

All Articles