atlas icon indicating copy to clipboard operation
atlas copied to clipboard

syncHostDevice doesn't allocate after a deallocateDevice call

Open l90lpa opened this issue 1 year ago • 1 comments

What happened?

I'm opening this issue to understand if the current interaction between syncHostDevice and deallocateDevice is expected.

Currently syncHostDevice only checks device_updated_ to determine if it should call updateDevice (which will allocate if device memory hasn't already been allocated). However, deallocateDevice only updates device_allocated_ leaving device_updated_ unchanged. This means that in circumstances where deallocateDevice is called with the device_updated_==true and then subsequentially syncHostDevice is called, no device memory allocation is performed.

For example:

    array::ArrayT<int> arr(3);
    arr.syncHostDevice();   // sets device_updated_=true
    arr.deallocateDevice(); // changes device_allocated_ but not device_updated_
    arr.syncHostDevice();   // no device allocation performed because device_updated_==true

I'm wonder if deallocateDevice should also set device_updated_=false?

What are the steps to reproduce the bug?

Build Atlas on develop with ENABLE_CUDA or ENABLE_HIP.

Version

develop

Platform (OS and architecture)

linux

Relevant log output

No response

Accompanying data

No response

Organisation

JCSDA

l90lpa avatar Nov 22 '24 00:11 l90lpa

That sounds indeed like an oversight. You're right that deallocateDevice shouldest device_updated_ to false.

wdeconinck avatar Dec 09 '24 10:12 wdeconinck