@@ -52,17 +52,46 @@ void GraphDataGenerator::AllocResource(const paddle::platform::Place& place,
5252 device_key_size_ = h_device_keys_->size ();
5353 d_device_keys_ =
5454 memory::AllocShared (place_, device_key_size_ * sizeof (int64_t ));
55+ for (size_t i = 0 ; i < h_device_keys_->size (); i++) {
56+ VLOG (2 ) << " h_device_keys_[" << i << " ] = " << (*h_device_keys_)[i];
57+ }
5558 CUDA_CHECK (cudaMemcpyAsync (d_device_keys_->ptr (), h_device_keys_->data (),
5659 device_key_size_ * sizeof (int64_t ),
5760 cudaMemcpyHostToDevice, stream_));
58- d_prefix_sum_ =
59- memory::AllocShared (place_, (sample_key_size_ + 1 ) * sizeof (int64_t ));
61+ size_t once_max_sample_keynum = walk_degree_ * once_sample_startid_len_;
62+ d_prefix_sum_ = memory::AllocShared (
63+ place_, (once_max_sample_keynum + 1 ) * sizeof (int64_t ));
6064 int64_t * d_prefix_sum_ptr = reinterpret_cast <int64_t *>(d_prefix_sum_->ptr ());
61- cudaMemsetAsync (d_prefix_sum_ptr, 0 , (sample_key_size_ + 1 ) * sizeof ( int64_t ),
62- stream_);
65+ cudaMemsetAsync (d_prefix_sum_ptr, 0 ,
66+ (once_max_sample_keynum + 1 ) * sizeof ( int64_t ), stream_);
6367 cursor_ = 0 ;
68+ jump_rows_ = 0 ;
6469 device_keys_ = reinterpret_cast <int64_t *>(d_device_keys_->ptr ());
65- ;
70+ VLOG (2 ) << " device_keys_ = " << (uint64_t )device_keys_;
71+ d_walk_ = memory::AllocShared (place_, buf_size_ * sizeof (int64_t ));
72+ cudaMemsetAsync (d_walk_->ptr (), 0 , buf_size_ * sizeof (int64_t ), stream_);
73+ d_sample_keys_ =
74+ memory::AllocShared (place_, once_max_sample_keynum * sizeof (int64_t ));
75+
76+ d_sampleidx2rows_.push_back (
77+ memory::AllocShared (place_, once_max_sample_keynum * sizeof (int )));
78+ d_sampleidx2rows_.push_back (
79+ memory::AllocShared (place_, once_max_sample_keynum * sizeof (int )));
80+ cur_sampleidx2row_ = 0 ;
81+
82+ d_len_per_row_ =
83+ memory::AllocShared (place_, once_max_sample_keynum * sizeof (int ));
84+ for (int i = -window_; i < 0 ; i++) {
85+ window_step_.push_back (i);
86+ }
87+ for (int i = 0 ; i < window_; i++) {
88+ window_step_.push_back (i + 1 );
89+ }
90+ buf_state_.Init (batch_size_, walk_len_, &window_step_);
91+ d_random_row_ = memory::AllocShared (
92+ place_,
93+ (once_sample_startid_len_ * walk_degree_ * repeat_time_) * sizeof (int ));
94+ shuffle_seed_ = 0 ;
6695 cudaStreamSynchronize (stream_);
6796}
6897
0 commit comments