# Building PyTorch with out of tree CUDNN

**URL:** <https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771>\
**Category:** Uncategorized\
**Created:** [March 31, 2018, 10:00pm UTC](https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771 "2018-03-31T22:00:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![username1](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/u/ee59a6/32.png) [@username1](https://discuss.pytorch.org/u/username1)\
**Post date:** [March 31, 2018, 10:00pm UTC](https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771/1 "2018-03-31T22:00:20Z")

</div>

Is there any difference between CUDNN\_LIB\_DIR and CUDNN\_LIBRARY enviroment variables fed to the setup.py script ?

The fillowing [line](https://github.com/pytorch/pytorch/blob/d5de0dca38f4764dc1c1393e955a2bb75c26537d/tools/setup_helpers/cudnn.py#L82) suggests that they should be the same, is this true ? If so, why do both of them exist ?

---

<div class="post-metadata">

**Author:** ![albanD](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alband/32/215_2.png) [@albanD](https://discuss.pytorch.org/u/albanD)\
**Post date:** [April 2, 2018, 3:11pm UTC](https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771/2 "2018-04-02T15:11:31Z")

</div>

Not sure about these in particular, but I would guess that these two variables are used by two different sub-libraries that are used by pytorch. In particular this makes sure that all of them compile with the same version of cudnn.

---

<div class="post-metadata">

**Author:** ![username1](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/u/ee59a6/32.png) [@username1](https://discuss.pytorch.org/u/username1)\
**Post date:** [April 3, 2018, 6:27pm UTC](https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771/3 "2018-04-03T18:27:05Z")

</div>

Okay, thanks for the reply, but the documentation does not make clear how to set them - should I set them both or just one will suffice. WIll it make sense to open a feature request, requesting to either merge them to one or add more comments to the docs ?

---

<div class="post-metadata">

**Author:** ![username1](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/u/ee59a6/32.png) [@username1](https://discuss.pytorch.org/u/username1)\
**Post date:** [April 5, 2018, 11:47am UTC](https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771/4 "2018-04-05T11:47:18Z")

</div>

Okay, thanks for the reply, but the documentation does not make clear how to set them - should I set them both or just one will suffice. WIll it make sense to open a feature request, requesting to either merge them to one or add more comments to the docs ?

---

<div class="post-metadata">

**Author:** ![albanD](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alband/32/215_2.png) [@albanD](https://discuss.pytorch.org/u/albanD)\
**Post date:** [April 5, 2018, 12:10pm UTC](https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771/5 "2018-04-05T12:10:00Z")

</div>

Hi,

Maybe @Soumith_Chintala can answer to that here (or point it to someone that knows)?

---

<div class="post-metadata">

**Author:** ![username1](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/u/ee59a6/32.png) [@username1](https://discuss.pytorch.org/u/username1)\
**Post date:** [April 6, 2018, 12:01pm UTC](https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771/6 "2018-04-06T12:01:42Z")

</div>

Did you mean @smth ?

---

<div class="post-metadata">

**Author:** ![smth](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/smth/32/13_2.png) [@smth](https://discuss.pytorch.org/u/smth)\
**Post date:** [April 6, 2018, 3:54pm UTC](https://discuss.pytorch.org/t/building-pytorch-with-out-of-tree-cudnn/15771/7 "2018-04-06T15:54:06Z")

</div>

just set `CUDNN_LIBRARY` OR `CUDNN_LIB_DIR` as environment variable. `CUDNN_LIBRARY` takes precedence if specified.
