Skip to content

源码中的部分 gflags 的手动赋值方式 #33404

@lytning98

Description

@lytning98

由于 issue #33208 中的原因,我需要手动为源码中的一些 gflags 赋值,如

DEFINE_string(cudnn_dir, "",
"Specify path for loading libcudnn.so. For instance, "
"/usr/local/cudnn/lib. If empty [default], dlopen "
"will search cudnn from LD_LIBRARY_PATH");

但我尝试过直接 export FLAGS_cudnn_dir=xxx 无效,使用 paddle.fluid.set_flags 则报错

>>> paddle.fluid.set_flags({'FLAGS_cudnn_dir': '/somewhere/anaconda3/lib'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/zhaoyao/anaconda3/envs/paddle/lib/python3.8/site-packages/paddle/fluid/framework.py", line 6159, in set_flags
    raise ValueError(
ValueError: Flag FLAGS_cudnn_dir cannot set its value through this function.

请问在使用paddlepaddle的时候如何正确赋值这些 flags ?

paddlepaddle 版本为 2.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions