Skip to content

Conversation

@luotao1
Copy link
Contributor

@luotao1 luotao1 commented Aug 7, 2017

fix #3303
related #1854

  1. build_doc don't depend on import py_paddle now, thus, remove import py_paddle in both conf.py.cn.in and conf.py.en.in
  2. As build_doc depends on import paddle, we can use '@PROJ_ROOT@/python/paddle instead of installing paddle python package, which will reduce a lot of time.

build_doc in Dockerfile (build.sh) will be updated in next PR.

@luotao1 luotao1 requested review from Xreki, reyoung and wangkuiyi August 7, 2017 13:19
Copy link
Collaborator

@wangkuiyi wangkuiyi left a comment

Choose a reason for hiding this comment

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

LGTM++

Thanks for this change!

Does it also fix #1854?

SOURCE_BRANCH="master"

# Clone the repo to output directory
mkdir output
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we use rm -rf output here? It seems that rmdir output works only when output is an empty directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the next line git clone $REPO output , we remain mkdir output here.

cd $TRAVIS_BUILD_DIR/build

# Compile paddle binaries first
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_GPU=OFF -DWITH_DOC=OFF -DWITH_MKLDNN=OFF -DWITH_MKLML=OFF -DWITH_GOLANG=ON -DWITH_STYLE_CHECK=OFF
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wow. Does this mean that the build_doc Travis job doesn't build Paddle twice now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, build_doc Travis Job doesn't build twice, and doesn't build the whole Paddle now.

@wangkuiyi
Copy link
Collaborator

Travis CI's build_doc jobs failed:

Generating sphinx documentation: html
Running Sphinx v1.5.6
making output directory...
Traceback (most recent call last):
  File "/home/travis/build/PaddlePaddle/Paddle/python/paddle/trainer/config_parser.py", line 85, in <module>
    from paddle.proto.DataConfig_pb2 import DataConfig
  File "/home/travis/build/PaddlePaddle/Paddle/python/paddle/proto/__init__.py", line 15, in <module>
    from paddle.proto.TrainerConfig_pb2 import OptimizationConfig, TrainerConfig
ImportError: No module named TrainerConfig_pb2
Configuration error:
The configuration file (or one of the modules it imports) called sys.exit()
make[3]: *** [doc/CMakeFiles/paddle_docs] Error 1
make[2]: *** [doc/CMakeFiles/paddle_docs.dir/all] Error 2
make[1]: *** [doc/CMakeFiles/paddle_docs.dir/rule] Error 2
make: *** [paddle_docs] Error 2

I tried to help fixing it, but no idea how to do it.

@Xreki
Copy link
Contributor

Xreki commented Aug 8, 2017

There are some other places that import py_paddle, and I'm afraid that building of py_paddle cannot be removed. See as following:

$ grep -r py_paddle *
paddle/v2/data_feeder.py:from py_paddle import DataProviderConverter
paddle/v2/data_feeder.py:        :type argument: py_paddle.swig_paddle.Arguments
paddle/v2/inference.py:        import py_paddle.swig_paddle as api
paddle/v2/parameters.py:        import py_paddle.swig_paddle as api
paddle/v2/parameters.py:        import py_paddle.swig_paddle as api
paddle/v2/parameters.py:    import py_paddle.swig_paddle as api
paddle/v2/__init__.py:    import py_paddle.swig_paddle as api
paddle/v2/event.py:        import py_paddle.swig_paddle as api
paddle/v2/tests/test_parameters.py:    import py_paddle
paddle/v2/tests/test_parameters.py:    del py_paddle
paddle/v2/tests/test_data_feeder.py:import py_paddle.swig_paddle as api
paddle/v2/optimizer.py:        import py_paddle.swig_paddle as swig_api
paddle/v2/optimizer.py:        import py_paddle.swig_paddle as swig_api
paddle/v2/optimizer.py:        import py_paddle.swig_paddle as swig_api
paddle/v2/optimizer.py:        import py_paddle.swig_paddle as swig_api
paddle/v2/optimizer.py:        import py_paddle.swig_paddle as swig_api
paddle/v2/optimizer.py:    import py_paddle.swig_paddle as swig_api
paddle/v2/trainer.py:        import py_paddle.swig_paddle as api
paddle/v2/trainer.py:        import py_paddle.swig_paddle as api
paddle/v2/trainer.py:        import py_paddle.swig_paddle as api

@luotao1
Copy link
Contributor Author

luotao1 commented Aug 8, 2017

@wangkuiyi
The reason is that proto/ is not generated in python/paddle directory, i.e. we need /python/paddle/proto. I will fix it.

@Xreki
All these py_paddle are in functions, such as:

class Optimizer(object):
    def __init__(self, **kwargs):
        import py_paddle.swig_paddle as swig_api
        if 'batch_size' in kwargs:
            del kwargs['batch_size']  # not important for python library.

When building the document, it only read __doc__ of class or function, don't come into themselves.

@luotao1
Copy link
Contributor Author

luotao1 commented Aug 8, 2017

@Xreki py_paddle in data_feeder.py will be fixed in next PR. Thx very much for your kindly help.

@luotao1 luotao1 merged commit 01c668e into PaddlePaddle:develop Aug 8, 2017
@luotao1 luotao1 deleted the doc branch August 8, 2017 09:54
@luotao1
Copy link
Contributor Author

luotao1 commented Aug 8, 2017

The travis time of build_doc from 35minutes to 5 minutes, and the total travis time is less than 10 minutes.

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.

build_doc in travis CI is slow

3 participants