Tfjs: Add the ability to specify gpu_options

Created on 3 Sep 2018  路  13Comments  路  Source: tensorflow/tfjs

TensorFlow.js version

0.12.6

Browser version

Node.js 10.9

Describe the problem or feature request

I am using tfjs-node-gpu and it allocates the whole memory of my GPU (the default TF behavior).
I request to have an ability to specify the backend options, particularly gpu_options.allow_growth.

node.js

Most helpful comment

There appears to be a workaround for setting allow_growth through an environment variable. This works for my tfjs-node-gpu project:

#Limit GPU memory usage with an environment variable
export TF_FORCE_GPU_ALLOW_GROWTH=true

All 13 comments

I have also run into this limitation and would love a solution (even if it involves messing with the bindings).

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

@rthadur What?

@vmarkovtsev feel free to reopen if this is still an issue .

@rthadur I cannot reopen. If a maintainer closes an issue, its original author does not have the permission. It has always worked this way for all repos on GitHub.

image

Anyway, I really like how you deal with the issues :+1:

+1, having access to gpu_options would be great.

+1 for gpu_options, gpu_memory_fraction will be very useful when training smaller models

+1 for gpu_options, gpu_memory_fraction

There appears to be a workaround for setting allow_growth through an environment variable. This works for my tfjs-node-gpu project:

#Limit GPU memory usage with an environment variable
export TF_FORCE_GPU_ALLOW_GROWTH=true

There appears to be a workaround for setting allow_growth through an environment variable. This works for my tfjs-node-gpu project:

#Limit GPU memory usage with an environment variable
export TF_FORCE_GPU_ALLOW_GROWTH=true

where need to write these command ?

There appears to be a workaround for setting allow_growth through an environment variable. This works for my tfjs-node-gpu project:

#Limit GPU memory usage with an environment variable
export TF_FORCE_GPU_ALLOW_GROWTH=true

where need to write these command ?

This is how I did it:

  1. Install the package dotenv via npm i dotenv
  2. Create a new file .env, make sure you include the ., within the root of your project's workspace
  3. Add TF_FORCE_GPU_ALLOW_GROWTH=true to the file and save it
  4. Add require('dotenv').config(); in your code, somewhere where it can be executed _first_, and before requiring tfjs of course

I tried adding TF_FORCE_GPU_ALLOW_GROWTH=true as an environment variable, and it seemed to have worked briefly, but upon trying to run my program once more, the error started appearing again.

cc. https://github.com/tensorflow/tfjs/issues/1469#issuecomment-586091169

I still get the error "Could not create cudnn handle: CUDNN_STATUS_ALLOC_FAILED" after I set "TF_FORCE_GPU_ALLOW_GROWTH=true". And still, there is no option to specify gpu_options.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ritikrishu picture ritikrishu  路  4Comments

lastnod picture lastnod  路  3Comments

JasonShin picture JasonShin  路  4Comments

pranayaryal picture pranayaryal  路  4Comments

Arturbarth picture Arturbarth  路  3Comments