Skip to content

Add cuDNN deterministic env variable (only for convolution) - #24355

Closed
duncanriach wants to merge 1 commit into
tensorflow:masterfrom
duncanriach:cudnn_deterministic_v2
Closed

duncanriach wants to merge 1 commit into
tensorflow:masterfrom
duncanriach:cudnn_deterministic_v2

Conversation

@duncanriach

@duncanriach duncanriach commented Dec 14, 2018 •

Copy link
Copy Markdown
Contributor

This change is a major component of the recipe for making TensorFlow training reproducible on GPUs.

Setting the environment variable TF_CUDNN_DETERMINISTIC=1 (or true) will ensure that both forward and backwards convolution algorithms are both fixed and deterministic. It overrides autotune and selects deterministic back-prop algorithms.

Attention @azaks2

Note: This pull request was previous issued incorrectly based on r1.12.

@ymodak
ymodak requested a review from timshen91 December 14, 2018 01:59
@ymodak ymodak self-assigned this Dec 14, 2018
@ymodak ymodak added the awaiting review Pull request awaiting review label Dec 14, 2018

CudnnSupport::CudnnSupport(CUDAExecutor* parent) : parent_(parent) {}
CudnnSupport::CudnnSupport(CUDAExecutor* parent) : parent_(parent) {
tensorflow::ReadBoolFromEnvVar("TF_CUDNN_DETERMINISTIC", false,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's only for convolution, maybe renamed it to TF_CUDNN_DETERMINISTIC_CONV, and cudnn_deterministic_conv_?

@duncanriach duncanriach Dec 17, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with that if it's preferable to others. I chose the more generic name because the intention would be to incrementally enhance its effect so that it makes all cuDNN functionality deterministic (e.g. including pooling). The longer-term goal is to switch all of these modes on with a single ConfigProto bool field (e.g. deterministic), which may include functionality beyond cuDNN.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that intention is fine, and TF_CUDNN_DETERMINISTIC is the right name for it. In this case, can you add a TODO(cudnn), saying that this env var needs to support all APIs in cudnn, but currently only supports conv?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. I'll add that above where the env var is read in the constructor.

@duncanriach duncanriach Dec 18, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done. I added the number of this PR, rather than "cudnn" (which seems ambiguous), so that this conversation can be referenced. Is that acceptable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I'm making that change now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks for the guidance and patience.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could someone tell me what "Google internal checks FAILED" means? I cannot see the output from that.

@timshen91 timshen91 Dec 26, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not being responsive. The error I saw was unused result of the call to ReadBoolFromEnvVar(). It returns a Status, and the potential error should be handled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks, Tim. I'll take account of that when I re-open this request.

@duncanriach
duncanriach force-pushed the cudnn_deterministic_v2 branch from 6b3e031 to adc157c Compare December 18, 2018 00:29
@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Dec 18, 2018
@duncanriach
duncanriach force-pushed the cudnn_deterministic_v2 branch from adc157c to 4785d40 Compare December 18, 2018 21:25
@timshen91 timshen91 added the ready to pull PR ready for merge process label Dec 18, 2018
@dksb dksb added the size:S CL Change Size: Small label Dec 21, 2018
@duncanriach

duncanriach commented Dec 22, 2018 •

Copy link
Copy Markdown
Contributor Author

There are some other refinements that I may want to make to this request before it gets pulled. I am going to close it for now, and I may re-open it later.

@duncanriach

Copy link
Copy Markdown
Contributor Author

Because I force-pushed the branch that this pull request is based on, while it was closed, it's not possible to re-open the pull request. I will have to create a new pull request.

@duncanriach

Copy link
Copy Markdown
Contributor Author

See follow-up pull request #24747.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes ready to pull PR ready for merge process size:S CL Change Size: Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants