Hi all;
I’m trying to attempt to get one kernel update an initial memory location with a value (in this example shown by the kernel name “insert”) and another kernel read the updated value from the same memory location used by the kernel name “insert” on the kernel name “read”. However, when the kernel “insert” set the memory location dev_pBF_bit_table[0x7277/0x7] and dev_pBitMask[0] to 180 and 9 respectively, the kernel “read”, read this memory location back as ‘0’.
I would like and expect the kernel “read” , read the memory location above as dev_pBF_bit_table[0x7277/0x7] = 180; and dev_pBitMask[0] to 180 = 9.
Can anyone of here provide some lights on how to do that ?
Below here is my code snippet :
__global__void insert(unsigned int *dev_pBitMask, unsigned int *dev_pBF_bit_table) {
dev_pBF_bit_table[0x7277/0x7] = 180;
dev_pBitMask[0] = 9;
}
__global__void read(unsigned int *dev_pBitMask, unsigned int *dev_pBF_bit_table) {
printf("DEBUG GPU : 0x%x, 0%x\n", dev_pBF_bit_table[0x7277/0x7],dev_pBitMask[0]);
}
int main()
{
// Instantiate a pointer for CUDA version of Bloom filter
unsigned int *dev_pBitMask = new unsigned int[8];
unsigned int *dev_pBF_bit_table = new unsigned int[8192];
for (int i = 0; i < 8; i++) {
dev_pBitMask[i] = bit_mask[i];
}
for (int i = 0; i < filter2.BF_raw_table_size_; i++) {
dev_pBF_bit_table[i] = filter2.BF_bit_table_[i];
}
:
:
:
:
const int dev_pBitMask_sizeof = (8)*sizeof(unsigned int);
const int dev_pBF_bit_table_sizeof = (8192)*sizeof(unsigned int);
cudaMalloc((void**)&dev_pBitMask, dev_pBitMask_sizeof);
cudaMalloc((void**)&dev_pBF_bit_table,dev_pBF_bit_table_sizeof);
insert <<< 1, 8>>>(dev_pBitMask , dev_pBF_bit_table);
match <<<1, 8>>> (dev_pBitMask , dev_pBF_bit_table);
:
:
:
return 0;
}