Skip to content

Multiple uses of svd or svd_inplace in the same program cause it to stall #123

Closed
@rennis250

Description

@rennis250

I've found that calling SVD functions more than once in the same program cause it to stall and start eating up lots of memory. It seems to be independent of whether you use svd or svd_inplace. It is also independent of whether you use the same array repeatedly or not. An example program:

extern crate arrayfire as af;

use af::*;

fn main() {
    set_backend(Backend::CPU);

    for x in 40000..50000 {
        let w = 400u64;
        let h = x as u64;

        let dims = Dim4::new(&[w, h, 1, 1]);
        let mut d: Array = randu::<f32>(dims);
        let mut e: Array = randu::<f32>(dims);
        if x == 40000 {
            println!("{}", d.dims());
        } else {
            println!("{}", e.dims());
        }

        println!("before svd");
        if x == 40000 {
            let (u, s, vt) = svd(&mut d);
        } else {
            let (u, s, vt) = svd(&mut e);
        }
        println!("after svd");
    }
}

On my Mac with 8GB of RAM, the second iteration of the loop hangs and starts eating up RAM. I'm using ArrayFire from the installer, Rust 1.16.0, and the latest version of this crate from crates.io. I will be able to test on a Linux machine later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Upstream Issues

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions