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

add static_mode_white_list #28112

Merged
merged 5 commits into from
Oct 21, 2020

Conversation

pangyoki
Copy link
Contributor

@pangyoki pangyoki commented Oct 20, 2020

PR types

Others

PR changes

Others

Describe

Background

Paddle 2.0 uses dygraph mode by default. PR #27443 has changed the default mode from static mode to dygraph mode.

However, there are some problems because of unittests are implemented based on static mode. It will cause conflicts when dygraph mode is opened by default.

In order to pass CI, before the unittest runs, PR #27443 switches the mode to static mode. The specific method is to modify test_runner.py, and the execution environment is static mode if ctest is used to run.

Problem

the behavior of using ctest and python to run unittests is inconsistent.

  • The execution environment ofctest is static mode
  • The execution environment of python is dygraph mode

developers need to develop unittest in static mode

Because the execution environment ofctest is static mode. In order to pass CI, developers need to develop unittest in static mode, it's inconsistent with the default mode of Paddle.

Solution

Add a static_mode_white_list. The white list saves the tesing modules whose execution environment is static mode.
ctest will change dygraph mode to static mode only if the test module is in static_mode_white_list.

  • If unittest module is in static_mode_white_list, use static mode to run ctest
  • If unittest module is not in static_mode_white_list, use dygraph mode to run ctest

Thus, subsequent developers can use the dygraph mode to develop unittest.

Next task

static_mode_white_list can't solve the problem of inconsistent environment when using ctest and python to execute.
Unittest modules in static_mode_white_list need to be modified so that they can be executed in dygraph mode by default.

For example, we can add paddle.enable_static in every unittest modules. This work will be discussed later.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

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

LGTM

@zhiqiu zhiqiu merged commit 2d45d9a into PaddlePaddle:develop Oct 21, 2020
@pangyoki pangyoki mentioned this pull request Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants