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

Feature Request: GPUOptions for Go binding #22926

Open
mattn opened this issue Oct 12, 2018 · 24 comments
Open

Feature Request: GPUOptions for Go binding #22926

mattn opened this issue Oct 12, 2018 · 24 comments

Comments

@mattn
Copy link
Contributor

@mattn mattn commented Oct 12, 2018

Current implementation of Go binding can not specify options.

GPUOptions struct is in internal package. And go generate doesn't work for protobuf directory. So we can't specify GPUOptions for NewSession.

@tensorflowbutler
Copy link
Member

@tensorflowbutler tensorflowbutler commented Oct 12, 2018

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
Have I written custom code
OS Platform and Distribution
TensorFlow installed from
TensorFlow version
Bazel version
CUDA/cuDNN version
GPU model and memory
Exact command to reproduce
Mobile device

@frreiss
Copy link
Contributor

@frreiss frreiss commented Dec 3, 2018

This problem appears to be broader than just specifying GPUOptions for TensorFlow sessions. There is no native Go API for passing any options when creating a session. The user must create the binary representation of a ConfigProto protocol buffer outside of the TensorFlow Go API.

See, for example, the test case TestSessionConfig in session_test.go:

func TestSessionConfig(t *testing.T) {
	// Exercise SessionOptions.
	// Arguably, a better API would be for SessionOptions.Config to be the
	// type generated by the protocol buffer compiler. But for now, the
	// tensorflow package continues to be independent of protocol buffers
	// and this test exercises the option since the implementation has a
	// nuanced conversion to C types.
	//
	// Till then, the []byte form of Config here was generated using a toy
	// tensorflow Python program:
	/*
	 import tensorflow
	 c = tensorflow.ConfigProto()
	 c.intra_op_parallelism_threads = 1
	 print c.SerializeToString()
	*/
	graph := NewGraph()
	c, err := Const(graph, "Const", int32(14))
	if err != nil {
		t.Fatal(err)
	}
	opts := SessionOptions{Config: []byte("(\x01")}
[...]

Would the TensorFlow maintainers accept a non-Google contribution that added the ability to specify session options using pure Go code? This functionality would require generating instances of the ConfigProto protocol buffer defined in config.proto. I can see two ways to generate these protocol buffers: Either add a build target to generate Go bindings for the files in tensorflow/core/protobuf; or add Go wrappers for the generated C++ code in tensorflow/core/protobuf/config.pb.h

@ymodak
Copy link
Contributor

@ymodak ymodak commented Dec 3, 2018

@asimshankar Can you please take a look? Thanks!

@alextp
Copy link
Contributor

@alextp alextp commented Mar 4, 2019

@frreiss we'll definitely accept a Go-only API to configure tensorflow.

@frreiss
Copy link
Contributor

@frreiss frreiss commented Mar 13, 2019

I am looking into this.

@frreiss
Copy link
Contributor

@frreiss frreiss commented Mar 13, 2019

Created PR #26682 with a Go API to create ConfigOptions protocol buffer messages. I made the changes as narrow in scope as I could.

@mattn
Copy link
Contributor Author

@mattn mattn commented Mar 30, 2019

Closed by #26682

@frreiss Thank you

@mattn mattn closed this Mar 30, 2019
@mattn
Copy link
Contributor Author

@mattn mattn commented Apr 5, 2019

@mattn mattn reopened this Apr 5, 2019
@imrahul361
Copy link

@imrahul361 imrahul361 commented Sep 28, 2020

is this issue open? Can i work on it? @mattn

@mattn
Copy link
Contributor Author

@mattn mattn commented Sep 30, 2020

Yes please.

@imrahul361
Copy link

@imrahul361 imrahul361 commented Oct 1, 2020

May I know how to reproduce the issue?

@mattn
Copy link
Contributor Author

@mattn mattn commented Oct 1, 2020

Sorry, I don't know why the changes was reverted.

#26682 (comment)

@imrahul361
Copy link

@imrahul361 imrahul361 commented Oct 1, 2020

ok no problem I will try some other issues

@AdeshKhandait
Copy link

@AdeshKhandait AdeshKhandait commented Oct 25, 2020

Hi,Adesh I am beginner i don't where start Can anybody help me?????

@Aditya-Komaravolu
Copy link

@Aditya-Komaravolu Aditya-Komaravolu commented Dec 19, 2020

Hello!
I am newbie to open source contribution and really interested to contribute!! . But I have very very less knowledge about it . Can anyone help me please?

@himanshu007-creator
Copy link

@himanshu007-creator himanshu007-creator commented Jan 1, 2021

can someone guide me what to do? i will be really thankful 👍

@Suraj-Upadhyay
Copy link
Contributor

@Suraj-Upadhyay Suraj-Upadhyay commented Jan 12, 2021

Kindly close this issue. It's confusing for first time contributors who come here for solving their first Issue.

@mattn
Copy link
Contributor Author

@mattn mattn commented Jan 12, 2021

I don't mind to close this but no one explain why #26682 was reverted.

@abadi003
Copy link

@abadi003 abadi003 commented Jan 13, 2021

is this still open?

@sajenjeshan1222
Copy link

@sajenjeshan1222 sajenjeshan1222 commented Feb 22, 2021

is it still open ?

@Gomesz785
Copy link

@Gomesz785 Gomesz785 commented Jul 20, 2021

@mattn is this issue closed?
if not
is it open for beginners to help?
if not then why does it have the good first issue??

@stellarshank
Copy link

@stellarshank stellarshank commented Jul 22, 2021

Assign me

@plopd
Copy link

@plopd plopd commented Jul 26, 2021

relax people! if u are here to solve these tasks, u are a beginner anyway.
just do it, regardless if someone already started working on the PR or not.
u will learn a bunch of stuff!!
don't focus too much on whether someone already started working on it. in that way, u will never start..

@i-am-epic
Copy link

@i-am-epic i-am-epic commented Aug 11, 2021

can any one guide me to this issue

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

Successfully merging a pull request may close this issue.

None yet