Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Each iteration produces the same sampling result #7

Open
gpzlx1 opened this issue Aug 16, 2022 · 1 comment
Open

[BUG] Each iteration produces the same sampling result #7

gpzlx1 opened this issue Aug 16, 2022 · 1 comment

Comments

@gpzlx1
Copy link
Collaborator

gpzlx1 commented Aug 16, 2022

The _SampleSubIndicesKernelFusedWithReplace uses fixed seed, making the results almost the same for each call. This can lead to poor training accuracy

template <typename IdType>
__global__ void _SampleSubIndicesKernelFusedWithReplace(IdType* sub_indices,
                                             IdType* indptr, IdType* indices,
                                             IdType* sub_indptr,
                                             IdType* column_ids, int64_t size) {
  int64_t row = blockIdx.x * blockDim.y + threadIdx.y;
  const uint64_t random_seed = 7777777;  // There's a problem here
  curandState rng;
  curand_init(random_seed * gridDim.x + blockIdx.x, threadIdx.x, 0, &rng);
  while (row < size) {
    int64_t col = column_ids[row];
    int64_t in_start = indptr[col];
    int64_t out_start = sub_indptr[row];
    int64_t degree = indptr[col + 1] - indptr[col];
    int64_t fanout = sub_indptr[row + 1] - sub_indptr[row];
    int64_t tid = threadIdx.x;
    while (tid < fanout) {
      // Sequential Sampling
      const int64_t edge = tid % degree;
      // Random Sampling
      // const int64_t edge = curand(&rng) % degree;
      sub_indices[out_start + tid] = indices[in_start + edge];
      tid += blockDim.x;
    }
    row += gridDim.x * blockDim.y;
  }
}
@gpzlx1
Copy link
Collaborator Author

gpzlx1 commented Aug 16, 2022

No need to fix this bug for now. This issue serves as a reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant