aleagpu - Alea GPU - Passing structures of arrays -
i have simple question. possible write structures of arrays alea.gpu?
public struct svdfactorsstructgpu { public deviceptr<float> itemsbiases; public deviceptr<float> usersbiases; public deviceptr<float> itemsfeatures; public deviceptr<float> usersfeatures; } [...] svdfactorsstructgpu factors = new svdfactorsstructgpu(); factors.itemsbiases = gpuitemsbiases.ptr; factors.usersbiases = gpuusersbiases.ptr; factors.itemsfeatures = gpuitemsfeatures.ptr; factors.usersfeatures = gpuusersfeatures.ptr; [...]
and pass them somehow kernel:
public void trainepochkernel(svdparamsstructgpu svdparams, deviceptr<float> ratings, deviceptr<int> ratingsitemsids, deviceptr<int> userprofilesids, deviceptr<int> ratingsstartidxs, deviceptr<int> ratingscounts, deviceptr<float> userprofilessse, svdfactorsstructgpu factors) { int startuserprofileidx = blockidx.x * (blockdim.x * svdparams.strideperthread) + threadidx.x * svdparams.strideperthread; [...] pred = svdparams.globalmean; pred += factors.itemsbiases[i]; pred += factors.usersbiases[u]; [...]
this works without structure yields illegal address when encapsulated.
thanks in advance
[edit #1] seems ptr copy in cause here, if try pass them structure directly in kernel signature error same.
[edit #2] maybe obvious question, tried pass devicememory<> directly unable set values. going keep "one parameter 1 array version" not critical , got efficient algorithm overall. curious know more on alea.gpu c#.
Comments
Post a Comment