DLL - Dynamic Linking in Cuda Kernel

Hi All,

Is possible to implement the dynamic linking: import a DLL file in a cuda kernel? With the following code for the CPU I can load at run-time a function previously compiled in an extern DLL:

#include <windows.h>
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>

#define MAXMODULE 50
typedef void (WINAPI*cfunc)(…);

cfunc NumberList;
int main (int argc, char *argv){

char pippo=“DLLTEST.DLL”;
HINSTANCE hLib=LoadLibrary(pippo);

 if(hLib==NULL) {
                cout<< "Impossibile caricare la libreria!"<< endl;
                getch();
                return 0;            
                }
 char mod[MAXMODULE];

GetModuleFileName((HMODULE)hLib, (LPTSTR)mod, MAXMODULE);
 cout <<"Libreria caricata: "<<mod<<endl;
 char nomeFunz[]="Somma";
 
 
 NumberList=(cfunc)GetProcAddress((HMODULE)hLib,nomeFunz);
 NumberList(atoi(argv[1]),atoi(argv[2]));
 
 FreeLibrary((HMODULE)hLib);
 getch();
 }

Thanks.

No.

Ok, sorry but… why not? Of course the dll file will have only device function. Is there another method to import at run-time an external function?

there’s no access to instruction memory from within the kernel. Once the kernel is DMA’d into the device during launch, theres no way to change it.
Kernel can’t execute instructions from any other device memory, and obviously not from host memory.