Access directly the "CUDA Memory" address from another parallel kernel?

I work with CUDALink and have some small successes.
I use direct calculation on GPU without using CPU (only for sanding commands for CUDA function). Until now I have stored on the hard drive with another kernel the data while GPU calculation (a the same time).

My question: How can I access directly the memory address from other kernel?
How can I declare the memory address in second Kernel ?

Kernel 1 => CUDA calculation

Kernel 2 => Export table on HDD

e.g. on two kernels I do in this way “schematically” (I know, it is a bad way):

ParallelEvaluate[
    
If[$KernelID==1,CUDAmem = CUDAMemoryAllocate [_Integer, {1000000}]];
    
];

CUDAmemMatematica=ParallelEvaluate[

If[$KernelID==1,CudaMemoryGet[CUDAmem]]

][[1]];

DistributeDefinitions[CUDAmemMatematica];

ParallelEvaluate [

If[$KernelID==1, Here same calculation on CUDAmem with CUDAFunctions];

,

Export["CUDAmem.dat",CUDAmemMatematica,"TABLE"];

];

I woud like to do this in this way “schematically”, but dont know how:

ParallelEvaluate[

If[$KernelID==1,CUDAmem=CUDAMemoryAllocate[_Integer,{1000000}]];

];

ParallelEvaluate[

If[$KernelID==2,CUDAmemMatematica=CudaMemoryGet[CUDAmem]];

];

ParallelEvaluate[

If[$KernelID==1,Here same calculation on CUDAmem with CUDAFunctions;

,

Export["CUDAmem.dat",CUDAmemMatematica,"TABLE"];

]];

Thanks for Your ideas

1 Like