You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following minimal reproducible example, which clearly eats up CPU memory when I run it (same issue with GPU client):
use anyhow::Result;
extern crate xla;
use xla::ArrayElement;
fn main() -> Result<()> {
let client = xla::PjRtClient::cpu()?;
let builder = xla::XlaBuilder::new("test");
let x = builder.parameter(0, f32::TY, &[1000000], "x")?;
let exec = x.build()?.compile(&client)?;
let mut x_val = xla::Literal::vec1(&[0f32; 1000000]);
loop {
let xla_buffers = exec.execute(&[&x_val])?;
let literal_out = xla_buffers[0][0].to_literal_sync()?;
x_val = literal_out.clone();
}
}
In principle, x_val is like the weights of a network being updated at each execution. Of course, it is very much not optimal to be transferring them to and from the GPU at every iteration, but I would still expect this to not leak memory, since the custom drop functions are being called every time the buffers/literals are going out of scope. But maybe there is something drastically incorrect about how I am using the library?
The text was updated successfully, but these errors were encountered:
I have the following minimal reproducible example, which clearly eats up CPU memory when I run it (same issue with GPU client):
In principle,
x_val
is like the weights of a network being updated at each execution. Of course, it is very much not optimal to be transferring them to and from the GPU at every iteration, but I would still expect this to not leak memory, since the customdrop
functions are being called every time the buffers/literals are going out of scope. But maybe there is something drastically incorrect about how I am using the library?The text was updated successfully, but these errors were encountered: