Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when using session.run with a variable on x86 Mac #424

Open
twilight-flower opened this issue Feb 29, 2024 · 2 comments
Open

Segfault when using session.run with a variable on x86 Mac #424

twilight-flower opened this issue Feb 29, 2024 · 2 comments

Comments

@twilight-flower
Copy link

Minimal example code:

use tensorflow::{Scope, Session, SessionOptions, SessionRunArgs, Variable};

fn main() {
   let mut s = Scope::new_root_scope();

   let variable = Variable::builder()
       .const_initial_value([1i64])
       .build(&mut s)
       .unwrap();

   let session = Session::new(&SessionOptions::new(), &s.graph_mut()).unwrap();
   let mut run_args = SessionRunArgs::new();
   run_args.add_target(&variable.initializer());
   session.run(&mut run_args).unwrap();
}

Running this code on my x86 Mac—with libtensorflow 2.15.0 installed via Homebrew, using Tensorflow 0.21.0 as the sole dependency in cargo.toml—leads to a segfault. The same didn't happen on a friend's x86 Linux machine, when she gave the code a test-run there. As far as we can tell, it's the variable that does it; code where no variables are interacting with session.run doesn't seem to have the same issue, on my machine.

@adamcrume
Copy link
Contributor

I haven't been able to reproduce this, either. (I only have an x86 Linux machine.) Can you try running your binary under valgrind? That'll be something like

cargo build --bin my_binary
valgrind target/debug/my_binary

@twilight-flower
Copy link
Author

I've failed to find any way of getting valgrind on mac short of building it myself, unfortunately, and I'm not quite confident enough with a compiler to do that. brew install valgrind yields an error Linux is required for this software. Do you know of any other ways I can get my hands on a working install?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants