Created
June 5, 2015 23:38
-
-
Save TangerineCat/e04dfa9f03d410a33a4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(getline(fbase, line)) | |
{ | |
cudaEventSynchronize(finishedMemcpyEvent); | |
if (!(fbase >> user >> movie >> day >> rating)){ | |
data_idx++; | |
continue; | |
} | |
// process the line. Store indices instead of values | |
buffer[data_idx % batchsize] = DataPoint(user - 1, movie - 1, rating); | |
if((data_idx % batchsize == batchsize - 1)){ | |
cudaMemcpyAsync(d_data[i], inbuffers[i], | |
batchsize * sizeof(DataPoint), cudaMemcpyHostToDevice, s[i]); | |
cudaEventRecord(finishedMemcpyEvent, s[i]); | |
// RUN KERNEL | |
cudaTrain(d_data[i], pack, | |
batchsize, nfactors, s[i]); | |
i = (i + 1) % nstreams; | |
if(VERBOSE) | |
printf("Batch %6d finished\n", data_idx/batchsize); | |
buffer = inbuffers[i]; | |
} | |
data_idx++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment