├── tools ├── codestyle │ ├── .gitignore │ ├── clang_format.hook │ ├── pylint_pre_commit.hook │ └── cpplint_pre_commit.hook ├── aws_benchmarking │ ├── server │ │ ├── logs │ │ │ └── master.log │ │ ├── requirements.txt │ │ ├── Dockerfile │ │ ├── pserver.sh.template │ │ └── trainer.sh.template │ ├── diagram.png │ └── client │ │ ├── requirements.txt │ │ └── Dockerfile ├── __init__.py └── manylinux1 │ └── build_scripts │ ├── python-tag-abi-tag.py │ └── install_nccl2.sh ├── paddle ├── fluid │ ├── pybind │ │ ├── .gitignore │ │ ├── inference_api.h │ │ ├── reader_py.h │ │ ├── exception.h │ │ ├── const_value.h │ │ ├── recordio.h │ │ ├── ir.h │ │ └── async_executor_py.h │ ├── framework │ │ ├── tensor_util.cu │ │ ├── data_type_transform.cu │ │ ├── .gitignore │ │ ├── commit.h.in │ │ ├── variable_helper.h │ │ ├── details │ │ │ └── multi_devices_helper.cc │ │ ├── lod_tensor_array.h │ │ ├── prune.h │ │ ├── proto_desc.h │ │ ├── ir │ │ │ ├── is_test_pass.h │ │ │ ├── sync_batch_norm_pass.h │ │ │ ├── runtime_context_cache_pass.h │ │ │ └── attention_lstm_fuse_pass.h │ │ ├── feed_fetch_type.h │ │ └── data_feed_factory.h │ ├── inference │ │ ├── paddle_fluid.sym │ │ ├── api │ │ │ ├── demo_ci │ │ │ │ ├── .gitignore │ │ │ │ ├── clean.sh │ │ │ │ ├── windows_inference.md │ │ │ │ └── README.md │ │ │ ├── README.md │ │ │ └── details │ │ │ │ └── CMakeLists.txt │ │ ├── paddle_fluid.map │ │ ├── utils │ │ │ └── CMakeLists.txt │ │ ├── tensorrt │ │ │ ├── plugin │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── anakin │ │ │ └── CMakeLists.txt │ │ ├── check_symbol.sh │ │ └── analysis │ │ │ ├── argument.cc │ │ │ ├── analysis_pass.cc │ │ │ ├── device.h │ │ │ ├── passes │ │ │ └── CMakeLists.txt │ │ │ └── flags.h │ ├── operators │ │ ├── csp │ │ │ └── CMakeLists.txt │ │ ├── metrics │ │ │ └── CMakeLists.txt │ │ ├── elementwise │ │ │ ├── CMakeLists.txt │ │ │ ├── elementwise_pow_op.cu │ │ │ ├── elementwise_mod_op.cu │ │ │ └── elementwise_floordiv_op.cu │ │ ├── optimizers │ │ │ ├── CMakeLists.txt │ │ │ ├── ftrl_op.cu │ │ │ ├── rmsprop_op.cu │ │ │ ├── proximal_gd_op.cu │ │ │ ├── proximal_adagrad_op.cu │ │ │ ├── decayed_adagrad_op.cu │ │ │ ├── adam_op.cu │ │ │ ├── adamax_op.cu │ │ │ └── adadelta_op.cu │ │ ├── sequence_ops │ │ │ ├── CMakeLists.txt │ │ │ ├── sequence_pool_op.cu │ │ │ └── sequence_slice_op.cu │ │ ├── math │ │ │ ├── detail │ │ │ │ └── CMakeLists.txt │ │ │ ├── concat.hip.cu │ │ │ ├── sample_prob.cc │ │ │ ├── context_project.cu │ │ │ └── context_project.cc │ │ ├── anakin │ │ │ └── CMakeLists.txt │ │ ├── benchmark │ │ │ └── CMakeLists.txt │ │ ├── controlflow │ │ │ └── CMakeLists.txt │ │ ├── tensorrt │ │ │ └── CMakeLists.txt │ │ ├── ngraph │ │ │ ├── CMakeLists.txt │ │ │ └── ops │ │ │ │ └── CMakeLists.txt │ │ ├── jit │ │ │ └── more │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── intrinsic │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── mix │ │ │ │ └── CMakeLists.txt │ │ │ │ └── mkl │ │ │ │ └── CMakeLists.txt │ │ ├── nccl │ │ │ └── CMakeLists.txt │ │ ├── fused │ │ │ └── CMakeLists.txt │ │ ├── minus_op.cu │ │ ├── dgc_op.cu │ │ ├── clip_by_norm_op.cu │ │ ├── assign_value_op.cu.cc │ │ ├── dgc_clip_by_norm_op.cu │ │ ├── distributed_ops │ │ │ └── split_byref_op.cu.cc │ │ ├── reduce_ops │ │ │ └── CMakeLists.txt │ │ ├── split_selected_rows_op.cu │ │ ├── sampling_id_op.cu │ │ ├── pad_op.cu │ │ ├── crop_op.cu │ │ ├── clip_op.cu │ │ ├── py_func_op.h │ │ ├── cos_sim_op.cu │ │ ├── l1_norm_op.cu │ │ ├── shape_op.cu │ │ ├── sync_batch_norm_op.cc │ │ ├── log_loss_op.cu │ │ ├── detection │ │ │ └── iou_similarity_op.cu │ │ ├── warpctc_op.cu.cc │ │ ├── hinge_loss_op.cu │ │ ├── huber_loss_op.cu │ │ ├── clip_by_norm_op.cc │ │ ├── merge_selected_rows_op.cu.cc │ │ ├── smooth_l1_loss_op.cu │ │ ├── squared_l2_norm_op.cu │ │ ├── cumsum_op.cu │ │ ├── random_crop_op.cu │ │ ├── im2sequence_op.cu │ │ ├── margin_rank_loss_op.cu │ │ ├── save_combine_op.cu │ │ ├── split_op.cu.cc │ │ ├── rank_loss_op.cu │ │ └── fill_constant_op.cu.cc │ ├── .clang-format │ ├── imperative │ │ ├── CMakeLists.txt │ │ └── profiler.h │ ├── string │ │ ├── CMakeLists.txt │ │ ├── pretty_log.cc │ │ └── split_test.cc │ ├── CMakeLists.txt │ ├── memory │ │ ├── CMakeLists.txt │ │ ├── detail │ │ │ └── CMakeLists.txt │ │ └── memory.h │ ├── recordio │ │ └── CMakeLists.txt │ ├── platform │ │ ├── dynload │ │ │ ├── cupti_lib_path.h.in │ │ │ ├── CMakeLists.txt │ │ │ ├── nccl.cc │ │ │ ├── curand.cc │ │ │ ├── mklml.cc │ │ │ ├── warpctc.cc │ │ │ └── tensorrt.cc │ │ ├── enforce.cc │ │ ├── cpu_helper_test.cc │ │ ├── hostdevice.h │ │ ├── cpu_helper.h │ │ └── cuda_device_guard.cc │ └── train │ │ └── CMakeLists.txt ├── contrib │ └── float16 │ │ └── .gitignore ├── scripts │ ├── doc │ │ ├── paddle-development-environment.png │ │ ├── paddle-development-environment-gpu.png │ │ ├── paddle-development-environment.graffle │ │ └── paddle-development-environment-gpu.graffle │ ├── CMakeLists.txt │ ├── installation_validate.py │ └── docker │ │ └── root │ │ ├── .gitconfig │ │ └── .bashrc ├── testing │ └── CMakeLists.txt ├── CMakeLists.txt ├── .gitignore └── .set_port.sh ├── python ├── paddle │ ├── .gitignore │ ├── fluid │ │ ├── .gitignore │ │ ├── tests │ │ │ ├── book │ │ │ │ ├── .gitignore │ │ │ │ ├── high-level-api │ │ │ │ │ ├── fit_a_line │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ ├── word2vec │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ ├── label_semantic_roles │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ ├── machine_translation │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ ├── recommender_system │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ ├── understand_sentiment │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── recognize_digits │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ └── image_classification │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── __init__.py │ │ │ ├── demo │ │ │ │ └── file_reader │ │ │ │ │ └── .gitignore │ │ │ ├── .gitignore │ │ │ ├── unittests │ │ │ │ ├── .gitignore │ │ │ │ ├── mkldnn │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_sum_mkldnn_op.py │ │ │ │ │ └── test_gaussian_random_mkldnn_op.py │ │ │ │ ├── ngraph │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_mean_ngraph_op.py │ │ │ │ │ ├── test_softmax_ngraph_op.py │ │ │ │ │ ├── test_mul_ngraph_op.py │ │ │ │ │ ├── test_accuracy_ngraph_op.py │ │ │ │ │ ├── test_scale_ngraph_op.py │ │ │ │ │ ├── test_concat_ngraph_op.py │ │ │ │ │ ├── test_sum_ngraph_op.py │ │ │ │ │ ├── test_batch_norm_ngraph_op.py │ │ │ │ │ ├── test_top_k_ngraph_op.py │ │ │ │ │ ├── test_adam_ngraph_op.py │ │ │ │ │ ├── test_elementwise_add_ngraph_op.py │ │ │ │ │ ├── test_conv2d_ngraph_op.py │ │ │ │ │ ├── test_momentum_ngraph_op.py │ │ │ │ │ ├── test_softmax_with_cross_entropy_ngraph_op.py │ │ │ │ │ └── test_cross_entropy_ngraph_op.py │ │ │ │ ├── __init__.py │ │ │ │ ├── test_install_check.py │ │ │ │ ├── test_create_op_doc_string.py │ │ │ │ ├── test_eager_deletion_transformer.py │ │ │ │ ├── test_partial_eager_deletion_transformer.py │ │ │ │ └── test_op_support_gpu.py │ │ │ ├── CMakeLists.txt │ │ │ ├── book_memory_optimization │ │ │ │ └── CMakeLists.txt │ │ │ └── __init__.py │ │ ├── contrib │ │ │ ├── slim │ │ │ │ ├── tests │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ └── __init__.py │ │ │ │ ├── __init__.py │ │ │ │ ├── graph │ │ │ │ │ └── __init__.py │ │ │ │ ├── prune │ │ │ │ │ └── __init__.py │ │ │ │ ├── distillation │ │ │ │ │ └── __init__.py │ │ │ │ ├── core │ │ │ │ │ └── __init__.py │ │ │ │ └── quantization │ │ │ │ │ └── __init__.py │ │ │ ├── tests │ │ │ │ └── CMakeLists.txt │ │ │ ├── reader │ │ │ │ ├── README.md │ │ │ │ └── __init__.py │ │ │ ├── int8_inference │ │ │ │ └── __init__.py │ │ │ ├── decoder │ │ │ │ └── __init__.py │ │ │ ├── quantize │ │ │ │ └── __init__.py │ │ │ └── utils │ │ │ │ └── __init__.py │ │ ├── distributed │ │ │ └── __init__.py │ │ ├── trainer.py │ │ ├── inferencer.py │ │ ├── transpiler │ │ │ └── details │ │ │ │ └── __init__.py │ │ └── dygraph │ │ │ └── profiler.py │ ├── reader │ │ └── tests │ │ │ ├── test_data_creator.txt │ │ │ ├── CMakeLists.txt │ │ │ ├── test_reader_recordio.dat │ │ │ ├── test_recordio_creator.dat │ │ │ └── __init__.py │ ├── dataset │ │ └── tests │ │ │ ├── CMakeLists.txt │ │ │ └── cat.jpg │ ├── distributed │ │ └── __init__.py │ ├── libs │ │ └── __init__.py │ ├── utils │ │ └── __init__.py │ └── proto │ │ └── __init__.py ├── .gitignore ├── requirements.txt └── __init__.py ├── benchmark ├── tensorflow │ ├── rnn │ │ ├── requirements.txt │ │ ├── README.md │ │ ├── run.sh │ │ └── run_multi.sh │ └── image │ │ ├── run_multi.sh │ │ └── run.sh ├── figs │ ├── alexnet-4gpu.png │ ├── rnn_lstm_cls.png │ ├── googlenet-4gpu.png │ ├── rnn_lstm_4gpus.png │ ├── vgg-cpu-infer.png │ ├── vgg-cpu-train.png │ ├── alexnet-cpu-infer.png │ ├── alexnet-cpu-train.png │ ├── resnet-cpu-infer.png │ ├── resnet-cpu-train.png │ ├── googlenet-cpu-infer.png │ └── googlenet-cpu-train.png ├── caffe │ └── image │ │ ├── solver.prototxt │ │ ├── run_multi.sh │ │ └── run.sh ├── .gitignore └── fluid │ ├── models │ └── __init__.py │ └── run_fluid_benchmark.sh ├── .style.yapf ├── cmake ├── CMakeTestGoCompiler.cmake ├── CMakeGoInformation.cmake ├── CMakeGoCompiler.cmake.in ├── ccache.cmake ├── FindGlog.cmake ├── external │ ├── dlpack.cmake │ ├── cub.cmake │ └── threadpool.cmake ├── FindJeMalloc.cmake ├── package.cmake ├── anakin_subgraph.cmake └── make_resource.py ├── .dockerignore ├── doc └── README.md ├── .travis.yml ├── .gitignore ├── .clang-format ├── go └── glide.yaml └── .github └── ISSUE_TEMPLATE └── ---feature-request-.md /tools/codestyle/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /paddle/fluid/pybind/.gitignore: -------------------------------------------------------------------------------- 1 | pybind.h 2 | -------------------------------------------------------------------------------- /python/paddle/.gitignore: -------------------------------------------------------------------------------- 1 | version.py 2 | -------------------------------------------------------------------------------- /tools/aws_benchmarking/server/logs/master.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /benchmark/tensorflow/rnn/requirements.txt: -------------------------------------------------------------------------------- 1 | tflearn 2 | -------------------------------------------------------------------------------- /paddle/fluid/framework/tensor_util.cu: -------------------------------------------------------------------------------- 1 | tensor_util.cc -------------------------------------------------------------------------------- /paddle/fluid/inference/paddle_fluid.sym: -------------------------------------------------------------------------------- 1 | *paddle* 2 | -------------------------------------------------------------------------------- /python/paddle/fluid/.gitignore: -------------------------------------------------------------------------------- 1 | proto 2 | core.so 3 | -------------------------------------------------------------------------------- /paddle/contrib/float16/.gitignore: -------------------------------------------------------------------------------- 1 | *.inference.model 2 | -------------------------------------------------------------------------------- /paddle/fluid/inference/api/demo_ci/.gitignore: -------------------------------------------------------------------------------- 1 | data 2 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/.gitignore: -------------------------------------------------------------------------------- 1 | *.inference.model 2 | -------------------------------------------------------------------------------- /paddle/fluid/framework/data_type_transform.cu: -------------------------------------------------------------------------------- 1 | data_type_transform.cc -------------------------------------------------------------------------------- /python/paddle/fluid/tests/demo/file_reader/.gitignore: -------------------------------------------------------------------------------- 1 | *.recordio 2 | -------------------------------------------------------------------------------- /.style.yapf: -------------------------------------------------------------------------------- 1 | [style] 2 | based_on_style = pep8 3 | column_limit = 80 4 | -------------------------------------------------------------------------------- /python/paddle/reader/tests/test_data_creator.txt: -------------------------------------------------------------------------------- 1 | 0 1 2 | 2 3 3 | 4 5 4 | -------------------------------------------------------------------------------- /paddle/fluid/framework/.gitignore: -------------------------------------------------------------------------------- 1 | .tensor_util.cu 2 | .data_type_transform.cu -------------------------------------------------------------------------------- /cmake/CMakeTestGoCompiler.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_Go_COMPILER_WORKS 1 CACHE INTERNAL "") 2 | -------------------------------------------------------------------------------- /python/paddle/dataset/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | py_test(test_image SRCS test_image.py) 2 | -------------------------------------------------------------------------------- /paddle/fluid/operators/csp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(operators) 2 | register_operators() 3 | -------------------------------------------------------------------------------- /paddle/fluid/operators/metrics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(operators) 2 | register_operators() 3 | -------------------------------------------------------------------------------- /paddle/fluid/operators/elementwise/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(operators) 2 | register_operators() 3 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(operators) 2 | register_operators() 3 | -------------------------------------------------------------------------------- /paddle/fluid/operators/sequence_ops/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(operators) 2 | register_operators() 3 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/.gitignore: -------------------------------------------------------------------------------- 1 | image/ 2 | fit_a_line.model/ 3 | tmp 4 | cuda_profiler.txt 5 | -------------------------------------------------------------------------------- /paddle/fluid/operators/math/detail/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cc_library(activation_functions SRCS avx_functions.cc) 2 | -------------------------------------------------------------------------------- /paddle/fluid/inference/api/demo_ci/clean.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | cd `dirname $0` 3 | rm -rf build/ data/ 4 | set +x 5 | -------------------------------------------------------------------------------- /benchmark/figs/alexnet-4gpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/alexnet-4gpu.png -------------------------------------------------------------------------------- /benchmark/figs/rnn_lstm_cls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/rnn_lstm_cls.png -------------------------------------------------------------------------------- /paddle/fluid/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | BasedOnStyle: Google 4 | Standard: Cpp11 5 | ... 6 | -------------------------------------------------------------------------------- /benchmark/figs/googlenet-4gpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/googlenet-4gpu.png -------------------------------------------------------------------------------- /benchmark/figs/rnn_lstm_4gpus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/rnn_lstm_4gpus.png -------------------------------------------------------------------------------- /benchmark/figs/vgg-cpu-infer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/vgg-cpu-infer.png -------------------------------------------------------------------------------- /benchmark/figs/vgg-cpu-train.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/vgg-cpu-train.png -------------------------------------------------------------------------------- /tools/aws_benchmarking/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/tools/aws_benchmarking/diagram.png -------------------------------------------------------------------------------- /benchmark/figs/alexnet-cpu-infer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/alexnet-cpu-infer.png -------------------------------------------------------------------------------- /benchmark/figs/alexnet-cpu-train.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/alexnet-cpu-train.png -------------------------------------------------------------------------------- /benchmark/figs/resnet-cpu-infer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/resnet-cpu-infer.png -------------------------------------------------------------------------------- /benchmark/figs/resnet-cpu-train.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/resnet-cpu-train.png -------------------------------------------------------------------------------- /python/paddle/dataset/tests/cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/python/paddle/dataset/tests/cat.jpg -------------------------------------------------------------------------------- /tools/aws_benchmarking/server/requirements.txt: -------------------------------------------------------------------------------- 1 | netaddr==0.7.19 2 | boto3==1.6.21 3 | namesgenerator==0.3 4 | paramiko==2.4.1 5 | -------------------------------------------------------------------------------- /benchmark/figs/googlenet-cpu-infer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/googlenet-cpu-infer.png -------------------------------------------------------------------------------- /benchmark/figs/googlenet-cpu-train.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/benchmark/figs/googlenet-cpu-train.png -------------------------------------------------------------------------------- /benchmark/tensorflow/rnn/README.md: -------------------------------------------------------------------------------- 1 | You also should install tflearn: 2 | 3 | ```bash 4 | pip install -r requirements.txt 5 | ``` 6 | -------------------------------------------------------------------------------- /paddle/fluid/inference/paddle_fluid.map: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | *paddle*; 4 | *Pass*; 5 | local: 6 | *; 7 | }; 8 | -------------------------------------------------------------------------------- /python/paddle/reader/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | py_test(creator_test SRCS creator_test.py) 2 | py_test(decorator_test SRCS decorator_test.py) 3 | -------------------------------------------------------------------------------- /tools/aws_benchmarking/client/requirements.txt: -------------------------------------------------------------------------------- 1 | netaddr==0.7.19 2 | boto3==1.6.21 3 | namesgenerator==0.3 4 | paramiko==2.4.1 5 | scp 6 | requests 7 | -------------------------------------------------------------------------------- /python/paddle/reader/tests/test_reader_recordio.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/python/paddle/reader/tests/test_reader_recordio.dat -------------------------------------------------------------------------------- /paddle/scripts/doc/paddle-development-environment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/paddle/scripts/doc/paddle-development-environment.png -------------------------------------------------------------------------------- /python/paddle/reader/tests/test_recordio_creator.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/python/paddle/reader/tests/test_recordio_creator.dat -------------------------------------------------------------------------------- /paddle/fluid/inference/utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cc_library(benchmark SRCS benchmark.cc DEPS enforce) 2 | cc_test(test_benchmark SRCS benchmark_tester.cc DEPS benchmark) 3 | -------------------------------------------------------------------------------- /paddle/scripts/doc/paddle-development-environment-gpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/paddle/scripts/doc/paddle-development-environment-gpu.png -------------------------------------------------------------------------------- /paddle/scripts/doc/paddle-development-environment.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/paddle/scripts/doc/paddle-development-environment.graffle -------------------------------------------------------------------------------- /paddle/scripts/doc/paddle-development-environment-gpu.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binhetech/Paddle/develop/paddle/scripts/doc/paddle-development-environment-gpu.graffle -------------------------------------------------------------------------------- /paddle/fluid/operators/anakin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | op_library(anakin_engine_op DEPS anakin_engine anakin_op_converter) 2 | # file(APPEND ${pybind_file} "USE_NO_KERNEL_OP(anakin_engine);\n") 3 | -------------------------------------------------------------------------------- /python/.gitignore: -------------------------------------------------------------------------------- 1 | *pyc 2 | build 3 | dist 4 | paddlepaddle.egg-info 5 | paddle.egg-info 6 | paddlepaddle_gpu.egg-info 7 | .idea 8 | paddle/proto/*.py 9 | paddle/proto/*.pyc 10 | -------------------------------------------------------------------------------- /paddle/testing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # for paddle test case 2 | 3 | if(WITH_TESTING) 4 | cc_library(paddle_gtest_main SRCS paddle_gtest_main.cc DEPS device_context memory gtest gflags) 5 | endif() 6 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | build/ 3 | *.user 4 | .vscode 5 | .idea 6 | .project 7 | .cproject 8 | .pydevproject 9 | Makefile 10 | .test_env/ 11 | third_party/ 12 | *~ 13 | bazel-* 14 | 15 | !build/*.deb 16 | -------------------------------------------------------------------------------- /paddle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(scripts) 2 | add_subdirectory(testing) 3 | set(PYTHON_TESTS_DIR ${PADDLE_BINARY_DIR}/python/paddle/fluid/tests CACHE INTERNAL "python tests directory") 4 | add_subdirectory(fluid) 5 | -------------------------------------------------------------------------------- /tools/aws_benchmarking/client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7.14-stretch 2 | 3 | ENV HOME /root 4 | COPY ./ /root/ 5 | WORKDIR /root 6 | RUN pip install -r /root/requirements.txt 7 | ENTRYPOINT ["python", "cluster_launcher.py"] -------------------------------------------------------------------------------- /tools/aws_benchmarking/server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7.14-stretch 2 | 3 | ENV HOME /root 4 | COPY ./ /root/ 5 | WORKDIR /root 6 | RUN pip install -r /root/requirements.txt 7 | ENTRYPOINT ["python", "cluster_master.py"] -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/.gitignore: -------------------------------------------------------------------------------- 1 | mnist.recordio 2 | mnist_0.recordio 3 | mnist_1.recordio 4 | mnist_2.recordio 5 | flowers.recordio 6 | wmt16.recordio 7 | data_balance_test.recordio 8 | data_balance_with_lod_test.recordio 9 | -------------------------------------------------------------------------------- /paddle/fluid/operators/benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cc_test(op_tester SRCS op_tester.cc op_tester_config.cc 2 | DEPS memory timer framework_proto proto_desc lod_tensor op_registry 3 | device_context scope ${GLOB_OP_LIB} ${GLOB_OPERATOR_DEPS}) 4 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/slim/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | foreach(src ${TEST_OPS}) 5 | py_test(${src} SRCS ${src}.py) 6 | endforeach() 7 | -------------------------------------------------------------------------------- /benchmark/caffe/image/solver.prototxt: -------------------------------------------------------------------------------- 1 | net: "alexnet.prototxt" 2 | base_lr: 0.01 3 | lr_policy: "fixed" 4 | display: 20 5 | max_iter: 200 6 | momentum: 0.9 7 | weight_decay: 0.0005 8 | snapshot: 10000 9 | snapshot_prefix: "models/caffe_alexnet_train" 10 | solver_mode: GPU 11 | -------------------------------------------------------------------------------- /cmake/CMakeGoInformation.cmake: -------------------------------------------------------------------------------- 1 | if(NOT CMAKE_Go_COMPILE_OBJECT) 2 | set(CMAKE_Go_COMPILE_OBJECT "go tool compile -l -N -o ") 3 | endif() 4 | 5 | if(NOT CMAKE_Go_LINK_EXECUTABLE) 6 | set(CMAKE_Go_LINK_EXECUTABLE "go tool link -o ") 7 | endif() 8 | -------------------------------------------------------------------------------- /benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | paddle/image/logs 2 | paddle/image/*.pyc 3 | paddle/image/train.list 4 | paddle/rnn/logs 5 | paddle/rnn/*.pyc 6 | paddle/rnn/imdb.pkl 7 | caffe/image/logs 8 | tensorflow/image/logs 9 | tensorflow/rnn/logs 10 | fluid/models/*.pyc 11 | fluid/logs 12 | fluid/nohup.out 13 | -------------------------------------------------------------------------------- /paddle/scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(submit_local.sh.in 2 | paddle 3 | @ONLY) 4 | 5 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/paddle DESTINATION bin 6 | PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ 7 | GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ) 8 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/mkldnn/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | foreach(TEST_OP ${TEST_OPS}) 5 | py_test_modules(${TEST_OP} MODULES ${TEST_OP}) 6 | endforeach(TEST_OP) 7 | -------------------------------------------------------------------------------- /paddle/fluid/inference/tensorrt/plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | nv_library(tensorrt_plugin 2 | SRCS trt_plugin.cc split_op_plugin.cu elementwise_op_plugin.cu 3 | prelu_op_plugin.cu trt_plugin_factory.cc 4 | avg_pool_op_plugin.cu 5 | DEPS enforce tensorrt_engine prelu) 6 | -------------------------------------------------------------------------------- /paddle/fluid/operators/controlflow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(operators) 2 | register_operators(DEPS naive_executor) 3 | cc_library(while_op_helper SRCS while_op_helper.cc DEPS operator) 4 | 5 | file(APPEND ${pybind_file} "USE_OP(less_than);\nUSE_OP(logical_and);\nUSE_NO_KERNEL_OP(read_from_array);\n") 6 | -------------------------------------------------------------------------------- /paddle/fluid/operators/tensorrt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | op_library(tensorrt_engine_op DEPS tensorrt_engine tensorrt_converter) 2 | file(APPEND ${pybind_file} "USE_NO_KERNEL_OP(tensorrt_engine);\n") 3 | nv_test(test_tensorrt_engine_op SRCS tensorrt_engine_op_test.cc 4 | DEPS tensorrt_engine_op 5 | analysis) 6 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/fit_a_line/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # default test 5 | foreach(src ${TEST_OPS}) 6 | py_test(${src} SRCS ${src}.py) 7 | endforeach() 8 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/word2vec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # default test 5 | foreach(src ${TEST_OPS}) 6 | py_test(${src} SRCS ${src}.py) 7 | endforeach() 8 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/label_semantic_roles/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # default test 5 | foreach(src ${TEST_OPS}) 6 | py_test(${src} SRCS ${src}.py) 7 | endforeach() 8 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/machine_translation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # default test 5 | foreach(src ${TEST_OPS}) 6 | py_test(${src} SRCS ${src}.py) 7 | endforeach() 8 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/recommender_system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # default test 5 | foreach(src ${TEST_OPS}) 6 | py_test(${src} SRCS ${src}.py) 7 | endforeach() 8 | -------------------------------------------------------------------------------- /paddle/fluid/imperative/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(WITH_PYTHON) 2 | cc_library(layer SRCS layer.cc DEPS proto_desc operator device_context blas pybind) 3 | cc_library(tracer SRCS tracer.cc DEPS proto_desc device_context pybind) 4 | cc_library(engine SRCS engine.cc) 5 | cc_library(imperative_profiler SRCS profiler.cc) 6 | endif() 7 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # default test 5 | foreach(src ${TEST_OPS}) 6 | py_test(${src} SRCS ${src}.py) 7 | endforeach() 8 | 9 | add_subdirectory(high-level-api) 10 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | foreach(TEST_OP ${TEST_OPS}) 5 | py_test_modules(${TEST_OP} MODULES ${TEST_OP} ENVS FLAGS_use_ngraph=true) 6 | endforeach(TEST_OP) 7 | -------------------------------------------------------------------------------- /python/requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.9.2 2 | numpy>=1.12 3 | protobuf>=3.1.0 4 | recordio>=0.1.0 5 | matplotlib==2.2.3 # TODO: let python3 paddlepaddle package use latest matplotlib 6 | rarfile 7 | scipy>=0.19.0 8 | Pillow 9 | nltk>=3.2.2 10 | graphviz 11 | six 12 | funcsigs 13 | pyyaml 14 | decorator 15 | prettytable 16 | -------------------------------------------------------------------------------- /cmake/CMakeGoCompiler.cmake.in: -------------------------------------------------------------------------------- 1 | set(CMAKE_Go_COMPILER "@CMAKE_Go_COMPILER@") 2 | set(CMAKE_Go_COMPILER_LOADED 1) 3 | 4 | set(CMAKE_Go_SOURCE_FILE_EXTENSIONS go) 5 | set(CMAKE_Go_LINKER_PREFERENCE 40) 6 | set(CMAKE_Go_OUTPUT_EXTENSION .o) 7 | set(CMAKE_Go_OUTPUT_EXTENSION_REPLACE 1) 8 | set(CMAKE_Go_COMPILER_ENV_VAR "GO_COMPILER") 9 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # For Readers and Developers 2 | 3 | Thanks for reading PaddlePaddle documentation. 4 | 5 | Since **September 17th, 2018**, the **0.15.0 and develop** documentation source has been moved to [FluidDoc Repo](https://github.com/PaddlePaddle/FluidDoc) and updated there. 6 | 7 | Please turn to FluidDoc Repo for the latest documentation. 8 | -------------------------------------------------------------------------------- /paddle/fluid/inference/anakin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cc_library(anakin_engine SRCS engine.cc DEPS framework_proto) 2 | cc_library(anakin_op_teller SRCS op_teller.cc DEPS framework_proto) 3 | target_link_libraries(anakin_engine anakin anakin_saber_common) 4 | cc_test(test_anakin_engine SRCS test_anakin_engine.cc DEPS anakin_engine) 5 | add_subdirectory(convert) 6 | -------------------------------------------------------------------------------- /paddle/fluid/string/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cc_library(stringpiece SRCS piece.cc) 2 | cc_library(pretty_log SRCS pretty_log.cc) 3 | cc_test(stringpiece_test SRCS piece_test.cc DEPS stringpiece glog gflags) 4 | cc_test(stringprintf_test SRCS printf_test.cc DEPS glog gflags) 5 | cc_test(to_string_test SRCS to_string_test.cc) 6 | cc_test(split_test SRCS split_test.cc) 7 | -------------------------------------------------------------------------------- /paddle/fluid/operators/ngraph/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(WITH_NGRAPH) 2 | cc_library(ngraph_bridge SRCS ngraph_bridge.cc DEPS operator framework_proto ngraph) 3 | cc_library(ngraph_engine SRCS ngraph_engine.cc DEPS ngraph_bridge framework_proto) 4 | op_library(ngraph_engine_op DEPS ngraph_engine op_registry op_info device_context) 5 | add_subdirectory(ops) 6 | endif() 7 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | foreach(src ${TEST_OPS}) 5 | py_test(${src} SRCS ${src}.py) 6 | endforeach() 7 | 8 | add_subdirectory(unittests) 9 | add_subdirectory(book) 10 | add_subdirectory(book_memory_optimization) 11 | -------------------------------------------------------------------------------- /cmake/ccache.cmake: -------------------------------------------------------------------------------- 1 | # Use ccache if found ccache program 2 | 3 | find_program(CCACHE_PATH ccache) 4 | 5 | if(CCACHE_PATH) 6 | message(STATUS "Ccache is founded, use ccache to speed up compile.") 7 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PATH}) 8 | set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_PATH}) 9 | endif(CCACHE_PATH) 10 | -------------------------------------------------------------------------------- /paddle/fluid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(memory) 2 | add_subdirectory(platform) 3 | add_subdirectory(framework) 4 | add_subdirectory(imperative) 5 | add_subdirectory(operators) 6 | add_subdirectory(string) 7 | add_subdirectory(recordio) 8 | add_subdirectory(pybind) 9 | 10 | # NOTE: please add subdirectory inference at last. 11 | add_subdirectory(inference) 12 | add_subdirectory(train) 13 | -------------------------------------------------------------------------------- /tools/aws_benchmarking/server/pserver.sh.template: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker run --network="host" -i -e "SERVER_ENDPOINT={SERVER_ENDPOINT}" -e "MASTER_ENDPOINT={MASTER_ENDPOINT}" -e "TASK_NAME={TASK_NAME}" -e "TRAINER_INDEX={TRAINER_INDEX}" -e "TRAINING_ROLE=PSERVER" -e "TRAINER_COUNT={TRAINER_COUNT}" -e "TRAINERS={TRAINER_COUNT}" -e "PSERVER_HOSTS={PSERVER_HOSTS}" -e "PSERVERS={PSERVER_HOSTS}" {DOCKER_IMAGE} {COMMAND} -------------------------------------------------------------------------------- /paddle/fluid/memory/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(detail) 2 | add_subdirectory(allocation) 3 | cc_library(malloc SRCS malloc.cc DEPS place enforce allocator_facade profiler) 4 | cc_library(memcpy SRCS memcpy.cc DEPS place) 5 | 6 | cc_library(memory 7 | DEPS 8 | malloc 9 | memcpy) 10 | #if (WITH_GPU) 11 | # nv_test(pinned_memory_test SRCS pinned_memory_test.cu DEPS place memory) 12 | #endif() 13 | -------------------------------------------------------------------------------- /tools/aws_benchmarking/server/trainer.sh.template: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | nvidia-docker run --network="host" -i -e "MASTER_ENDPOINT={MASTER_ENDPOINT}" -e "TASK_NAME={TASK_NAME}" -e "TRAINER_COUNT={TRAINER_COUNT}" -e "TRAINERS={TRAINER_COUNT}" -e "TRAINER_INDEX={TRAINER_INDEX}" -e "PADDLE_INIT_TRAINER_ID={TRAINER_INDEX}" -e "TRAINING_ROLE=TRAINER" -e "PSERVER_HOSTS={PSERVER_HOSTS}" -e "PSERVERS={PSERVER_HOSTS}" {DOCKER_IMAGE} {COMMAND} -------------------------------------------------------------------------------- /paddle/fluid/operators/jit/more/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | function(USE_JITKERNEL_MORE TARGET TYPE) 3 | file(APPEND ${jit_file} "USE_JITKERNEL_MORE(${TARGET} ${TYPE});\n") 4 | endfunction() 5 | 6 | if(WITH_MKLML) 7 | add_subdirectory(mkl) 8 | endif() 9 | 10 | if(WITH_AVX) 11 | add_subdirectory(intrinsic) 12 | endif() 13 | 14 | # mix should be last 15 | add_subdirectory(mix) 16 | 17 | set(JIT_KERNEL_DEPS ${JIT_KERNEL_DEPS} PARENT_SCOPE) 18 | -------------------------------------------------------------------------------- /tools/codestyle/clang_format.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | readonly VERSION="3.8" 5 | 6 | version=$(clang-format -version) 7 | 8 | if ! [[ $version == *"$VERSION"* ]]; then 9 | echo "clang-format version check failed." 10 | echo "a version contains '$VERSION' is needed, but get '$version'" 11 | echo "you can install the right version, and make an soft-link to '\$PATH' env" 12 | exit -1 13 | fi 14 | 15 | clang-format $@ 16 | -------------------------------------------------------------------------------- /paddle/fluid/operators/jit/more/intrinsic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB jit_kernel_cc_intrinsic RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.cc") 3 | cc_library(jit_kernel_intrinsic SRCS ${jit_kernel_cc_intrinsic} DEPS jit_kernel_base) 4 | 5 | set(JIT_KERNEL_DEPS ${JIT_KERNEL_DEPS} jit_kernel_intrinsic PARENT_SCOPE) 6 | 7 | # use mkl kernels by name and type 8 | USE_JITKERNEL_MORE(kCRFDecoding, intrinsic) 9 | USE_JITKERNEL_MORE(kLayerNorm, intrinsic) 10 | -------------------------------------------------------------------------------- /paddle/fluid/framework/commit.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace paddle { 6 | namespace framework { 7 | 8 | static std::string paddle_commit() { 9 | return "@PADDLE_COMMIT@"; 10 | } 11 | 12 | static std::string paddle_compile_branch() { 13 | return "@PADDLE_BRANCH@"; 14 | } 15 | 16 | static std::string paddle_version() { 17 | return "@PADDLE_VERSION@"; 18 | } 19 | 20 | } // namespace framework 21 | } // namespace paddle 22 | -------------------------------------------------------------------------------- /paddle/fluid/inference/check_symbol.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | lib=$1 4 | if [ $# -ne 1 ]; then echo "No input library"; exit -1 ; fi 5 | 6 | num_paddle_syms=$(nm -D ${lib} | grep paddle | wc -l) 7 | num_google_syms=$(nm -D ${lib} | grep google | grep -v paddle | grep T | wc -l) 8 | 9 | if [ $num_paddle_syms -le 0 ]; then echo "Have no paddle symbols"; exit -1 ; fi 10 | if [ $num_google_syms -ge 1 ]; then echo "Have some google symbols"; exit -1 ; fi 11 | 12 | exit 0 13 | -------------------------------------------------------------------------------- /paddle/fluid/inference/tensorrt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | nv_library(tensorrt_engine SRCS engine.cc trt_int8_calibrator.cc DEPS ${GLOB_OPERATOR_DEPS} framework_proto device_context) 2 | nv_library(tensorrt_op_teller SRCS op_teller.cc DEPS framework_proto) 3 | nv_test(test_tensorrt SRCS test_tensorrt.cc DEPS dynload_cuda device_context dynamic_loader) 4 | nv_test(test_tensorrt_engine SRCS test_engine.cc DEPS dynload_cuda tensorrt_engine) 5 | add_subdirectory(plugin) 6 | add_subdirectory(convert) 7 | -------------------------------------------------------------------------------- /paddle/fluid/operators/nccl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(WITH_GPU AND NOT WIN32) 2 | nv_library(nccl_common SRCS nccl_gpu_common.cc DEPS device_context operator ) 3 | endif() 4 | 5 | if(WITH_GPU) 6 | op_library(nccl_op DEPS nccl_common) 7 | file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(ncclAllReduce);\n") 8 | set(OPERATOR_DEPS ${OPERATOR_DEPS} nccl_common PARENT_SCOPE) 9 | endif() 10 | 11 | if(NOT WIN32) 12 | nv_test(nccl_op_test SRCS nccl_op_test.cu.cc DEPS nccl_op gpu_info device_context) 13 | endif() 14 | -------------------------------------------------------------------------------- /paddle/fluid/operators/ngraph/ops/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB LIST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") 2 | set(pass_file ${PADDLE_BINARY_DIR}/paddle/fluid/operators/ngraph/ngraph_ops.h) 3 | file(APPEND ${pass_file} "\#pragma once\n") 4 | file(WRITE ${pass_file} "// Generated by the /paddle/fluid/operators/ngraph/ops/CMakeLists.txt. DO NOT EDIT!\n\n") 5 | 6 | foreach(OPS_NAME ${LIST_OPS}) 7 | file(APPEND ${pass_file} "\#include \"paddle/fluid/operators/ngraph/ops/${OPS_NAME}\"\n") 8 | endforeach(OPS_NAME) 9 | -------------------------------------------------------------------------------- /paddle/fluid/recordio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # internal library. 2 | cc_library(header SRCS header.cc) 3 | cc_test(header_test SRCS header_test.cc DEPS header) 4 | cc_library(chunk SRCS chunk.cc DEPS snappystream snappy header zlib) 5 | cc_test(chunk_test SRCS chunk_test.cc DEPS chunk) 6 | cc_library(writer SRCS writer.cc DEPS chunk) 7 | cc_library(scanner SRCS scanner.cc DEPS chunk) 8 | cc_test(writer_scanner_test SRCS writer_scanner_test.cc DEPS writer scanner) 9 | cc_library(recordio DEPS chunk header writer scanner) 10 | -------------------------------------------------------------------------------- /paddle/fluid/operators/fused/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(operators) 2 | register_operators(EXCLUDES fusion_transpose_flatten_concat_op fusion_conv_inception_op) 3 | if (WITH_GPU) 4 | op_library(fusion_transpose_flatten_concat_op) 5 | file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(fusion_transpose_flatten_concat);\n") 6 | if (NOT ${CUDNN_VERSION} VERSION_LESS 7100) 7 | op_library(fusion_conv_inception_op) 8 | file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(conv2d_inception_fusion);\n") 9 | endif() 10 | endif() 11 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | if(APPLE OR WIN32 OR NOT WITH_MKL) 5 | list(REMOVE_ITEM TEST_OPS test_calibration) 6 | endif() 7 | 8 | foreach(src ${TEST_OPS}) 9 | if(src MATCHES "test_calibration") 10 | py_test(${src} SRCS ${src}.py ENVS FLAGS_use_mkldnn=true) 11 | else() 12 | py_test(${src} SRCS ${src}.py) 13 | endif() 14 | endforeach() 15 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/understand_sentiment/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # This test is buggy 5 | # py_test(test_understand_sentiment_dynamic_rnn SRCS 6 | # test_understand_sentiment_dynamic_rnn.py SERIAL) 7 | LIST(REMOVE_ITEM TEST_OPS test_understand_sentiment_dynamic_rnn) 8 | 9 | # default test 10 | foreach(src ${TEST_OPS}) 11 | py_test(${src} SRCS ${src}.py) 12 | endforeach() 13 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/reader/README.md: -------------------------------------------------------------------------------- 1 | ## CTR READER 2 | 3 | An multi-thread cpp reader that has the same interface with py_reader. It 4 | uses cpp multi-thread to read file and is much more faster then the Python read 5 | thread in py_reader. 6 | 7 | Currently, it support two types of file: 8 | - gzip 9 | - plain text file 10 | 11 | and two types of data format: 12 | - cvs data format is : 13 | * label dense_fea,dense_fea sparse_fea,sparse_fea 14 | - the svm data format is : 15 | * label slot1:fea_sign slot2:fea_sign slot1:fea_sign 16 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book_memory_optimization/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | list(REMOVE_ITEM TEST_OPS test_memopt_image_classification_train) 5 | py_test(test_memopt_image_classification_train_resnet SRCS test_memopt_image_classification_train.py ARGS resnet) 6 | py_test(test_memopt_image_classification_train_vgg SRCS test_memopt_image_classification_train.py ARGS vgg) 7 | 8 | # default test 9 | foreach(src ${TEST_OPS}) 10 | py_test(${src} SRCS ${src}.py) 11 | endforeach() 12 | -------------------------------------------------------------------------------- /paddle/.gitignore: -------------------------------------------------------------------------------- 1 | .timestamp 2 | *.o 3 | *.a 4 | .svn 5 | GPATH 6 | GRTAGS 7 | GTAGS 8 | .idl* 9 | *~ 10 | *.pyc 11 | *.pb.cc 12 | *.pb.h 13 | *_pb2.py 14 | output/ 15 | google/ 16 | Makefile 17 | log/ 18 | .pptool_config 19 | hf/ 20 | build 21 | issue.info 22 | 23 | ar 24 | g++ 25 | gcc 26 | ld 27 | ld-linux-x86-64.so.2 28 | x86_64-scm-linux-gnu/ 29 | .lint.*.md5 30 | 31 | .idea/ 32 | .test_env 33 | Paddle_wrap.cxx 34 | Paddle_wrap.h 35 | paddle.py 36 | py_paddle-*.whl 37 | py_paddle/paddle.py 38 | .py_paddle_extra_link_flags 39 | HPPL_ERROR_LOG 40 | unittest.list 41 | proto 42 | dist 43 | setup.py 44 | -------------------------------------------------------------------------------- /paddle/fluid/operators/jit/more/mix/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | file(GLOB jit_kernel_mix_cc RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.cc") 4 | cc_library(jit_kernel_mix SRCS ${jit_kernel_mix_cc} DEPS jit_kernel_base) 5 | 6 | set(JIT_KERNEL_DEPS ${JIT_KERNEL_DEPS} jit_kernel_mix PARENT_SCOPE) 7 | 8 | USE_JITKERNEL_MORE(kVSigmoid, mix) 9 | USE_JITKERNEL_MORE(kVTanh, mix) 10 | USE_JITKERNEL_MORE(kLSTMCtHt, mix) 11 | USE_JITKERNEL_MORE(kLSTMC1H1, mix) 12 | USE_JITKERNEL_MORE(kGRUH1, mix) 13 | USE_JITKERNEL_MORE(kGRUHtPart1, mix) 14 | USE_JITKERNEL_MORE(kGRUHtPart2, mix) 15 | USE_JITKERNEL_MORE(kSoftmax, mix) 16 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # default test 5 | foreach(src ${TEST_OPS}) 6 | py_test(${src} SRCS ${src}.py) 7 | endforeach() 8 | 9 | add_subdirectory(fit_a_line) 10 | add_subdirectory(recognize_digits) 11 | add_subdirectory(image_classification) 12 | add_subdirectory(understand_sentiment) 13 | add_subdirectory(label_semantic_roles) 14 | add_subdirectory(word2vec) 15 | add_subdirectory(recommender_system) 16 | add_subdirectory(machine_translation) 17 | -------------------------------------------------------------------------------- /benchmark/tensorflow/image/run_multi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | function test() { 6 | cfg=$1 7 | num_gpu=$2 8 | batch_size=$3 9 | batch_per_gpu=`expr ${batch_size} / ${num_gpu}` 10 | prefix=$4 11 | python $cfg --num_gpus=$num_gpu --batch_size=${batch_per_gpu} > logs/${prefix}-4gpu-${batch_size}.log 2>&1 12 | } 13 | 14 | if [ ! -d "logs" ]; then 15 | mkdir logs 16 | fi 17 | 18 | # alexnet 19 | test alexnet_multi_gpu.py 4 512 alexnet 20 | test alexnet_multi_gpu.py 4 1024 alexnet 21 | 22 | # googlenet 23 | test googlenet_multi_gpu.py 4 512 alexnet 24 | test googlenet_multi_gpu.py 4 1024 alexnet 25 | -------------------------------------------------------------------------------- /paddle/fluid/inference/api/README.md: -------------------------------------------------------------------------------- 1 | # Embed Paddle Inference in Your Application 2 | 3 | Paddle inference offers the APIs in `C` and `C++` languages. 4 | 5 | You can easily deploy a model trained by Paddle following the steps as below: 6 | 7 | 1. Optimize the native model; 8 | 2. Write some codes for deployment. 9 | 10 | ## The APIs 11 | 12 | All the released APIs are located in the `paddle_inference_api.h` header file. 13 | The stable APIs are wrapped by `namespace paddle`, the unstable APIs are protected by `namespace paddle::contrib`. 14 | 15 | ## Write some codes 16 | 17 | Read `paddle_inference_api.h` for more information. 18 | -------------------------------------------------------------------------------- /paddle/fluid/memory/detail/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cc_library(memory_block SRCS memory_block.cc memory_block_desc.cc meta_cache.cc) 2 | 3 | if(${WITH_GPU}) 4 | nv_library(system_allocator SRCS system_allocator.cc DEPS gflags cpu_info gpu_info) 5 | else(${WITH_GPU}) 6 | cc_library(system_allocator SRCS system_allocator.cc DEPS gflags cpu_info) 7 | endif(${WITH_GPU}) 8 | 9 | cc_test(system_allocator_test SRCS system_allocator_test.cc DEPS system_allocator) 10 | 11 | cc_library(buddy_allocator SRCS buddy_allocator.cc DEPS memory_block system_allocator glog) 12 | 13 | cc_test(buddy_allocator_test SRCS buddy_allocator_test.cc DEPS buddy_allocator) 14 | -------------------------------------------------------------------------------- /python/paddle/fluid/distributed/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | -------------------------------------------------------------------------------- /python/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tools/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /python/paddle/distributed/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /python/paddle/reader/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /benchmark/tensorflow/rnn/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | function test() { 6 | lstm_num=$1 7 | batch_size=$2 8 | hid_size=$3 9 | prefix=$4 10 | python rnn.py --num_layers=${lstm_num} --batch_size=$batch_size \ 11 | --hidden_size=${hid_size} \ 12 | --forward_backward_only=1 \ 13 | > logs/1gpu-${lstm_num}lstm-batch${batch_size}-hid${hid_size}.log 2>&1 14 | } 15 | 16 | if [ ! -d "logs" ]; then 17 | mkdir logs 18 | fi 19 | 20 | #--lstm_num--batch_size--hidden_size--# 21 | test 2 64 256 22 | test 2 64 512 23 | test 2 64 1280 24 | 25 | test 2 128 256 26 | test 2 128 512 27 | test 2 128 1280 28 | 29 | test 2 256 256 30 | test 2 256 512 31 | test 2 256 1280 32 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/slim/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/mkldnn/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /paddle/fluid/operators/math/concat.hip.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 paddlepaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /benchmark/caffe/image/run_multi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | function test() { 5 | cfg=$1 6 | batch=$2 7 | prefix=$3 8 | batch_per_gpu=`expr ${batch} / 4` 9 | sed -i "/input: \"data\"/{n;s/^input_dim.*/input_dim: ${batch_per_gpu}/g}" $cfg 10 | sed -i "/input: \"label\"/{n;s/^input_dim.*/input_dim: ${batch_per_gpu}/g}" $cfg 11 | sed -i "1c\net : \"${cfg}\"" solver.prototxt 12 | caffe train --solver=solver.prototxt -gpu 0,1,2,3 > logs/${prefix}-4gpu-batch${batch}.log 2>&1 13 | } 14 | 15 | if [ ! -d "logs" ]; then 16 | mkdir logs 17 | fi 18 | 19 | # alexnet 20 | test alexnet.prototxt 512 alexnet 21 | test alexnet.prototxt 1024 alexnet 22 | 23 | # googlnet 24 | test googlenet.prototxt 512 googlenet 25 | -------------------------------------------------------------------------------- /tools/codestyle/pylint_pre_commit.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TOTAL_ERRORS=0 4 | 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 7 | export PYTHONPATH=$DIR:$PYTHONPATH 8 | 9 | # The trick to remove deleted files: https://stackoverflow.com/a/2413151 10 | for file in $(git diff --name-status | awk '$1 != "D" {print $2}'); do 11 | pylint --disable=all --load-plugins=docstring_checker \ 12 | --enable=doc-string-one-line,doc-string-end-with,doc-string-with-all-args,doc-string-triple-quotes,doc-string-missing,doc-string-indent-error,doc-string-with-returns,doc-string-with-raises $file; 13 | TOTAL_ERRORS=$(expr $TOTAL_ERRORS + $?); 14 | done 15 | 16 | exit $TOTAL_ERRORS 17 | #For now, just warning: 18 | #exit 0 19 | 20 | -------------------------------------------------------------------------------- /benchmark/tensorflow/image/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | function test() { 6 | cfg=$1 7 | batch_size=$2 8 | prefix=$3 9 | python $cfg --batch_size=$batch_size > logs/${prefix}-1gpu-${batch_size}.log 2>&1 10 | } 11 | 12 | if [ ! -d "logs" ]; then 13 | mkdir logs 14 | fi 15 | 16 | # alexnet 17 | test alexnet.py 64 alexnet 18 | test alexnet.py 128 alexnet 19 | test alexnet.py 256 alexnet 20 | test alexnet.py 512 alexnet 21 | 22 | # googlenet 23 | test googlenet.py 64 googlenet 24 | test googlenet.py 128 googlenet 25 | 26 | # smallnet 27 | test smallnet_mnist_cifar.py 64 smallnet 28 | test smallnet_mnist_cifar.py 128 smallnet 29 | test smallnet_mnist_cifar.py 256 smallnet 30 | test smallnet_mnist_cifar.py 512 smallnet 31 | -------------------------------------------------------------------------------- /python/paddle/libs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # used for setup.py.in to store the thirdparty shared libraries 16 | -------------------------------------------------------------------------------- /python/paddle/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .plot import Ploter 16 | __all__ = ['dump_config', 'Ploter'] 17 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/slim/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .core import * 16 | __all__ = ['Compressor', ] 17 | -------------------------------------------------------------------------------- /paddle/fluid/platform/dynload/cupti_lib_path.h.in: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | #define CUPTI_LIB_PATH "@CUPTI_LIBRARY_PATH@" 18 | -------------------------------------------------------------------------------- /python/paddle/fluid/trainer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # NOTE: Trainer is moved into fluid.contrib.trainer. 16 | __all__ = [] 17 | -------------------------------------------------------------------------------- /benchmark/tensorflow/rnn/run_multi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | function test() { 6 | num_gpu=$1 7 | lstm_num=$2 8 | hid_size=$3 9 | batch_per_gpu=`expr ${batch_size} / ${num_gpu}` 10 | batch_size=$4 11 | python rnn_multi_gpu.py --num_layers=${lstm_num} --batch_size=$batch_per_gpu \ 12 | --num_gpus=${num_gpu} \ 13 | --hidden_size=${hid_size} \ 14 | --forward_backward_only=1 \ 15 | > logs/${num_gpu}gpu-${lstm_num}lstm-hid${hid_size}-batch${batch_size}.log 2>&1 16 | } 17 | 18 | if [ ! -d "logs" ]; then 19 | mkdir logs 20 | fi 21 | 22 | #--num_gpus--lstm_num--hiddne_size--batch_size--# 23 | test 4 2 256 128 24 | test 4 2 256 256 25 | test 4 2 256 512 26 | 27 | test 4 2 512 128 28 | test 4 2 512 256 29 | test 4 2 512 512 30 | -------------------------------------------------------------------------------- /paddle/fluid/inference/analysis/argument.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "paddle/fluid/inference/analysis/argument.h" 16 | -------------------------------------------------------------------------------- /paddle/.set_port.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | DIRNAME=`dirname $0` 17 | source $DIRNAME/.common_test_util.sh 18 | set_port $@ 19 | -------------------------------------------------------------------------------- /paddle/fluid/operators/jit/more/mkl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cc_library(jit_kernel_mkl SRCS mkl.cc DEPS jit_kernel_base dynload_mklml) 3 | set(JIT_KERNEL_DEPS ${JIT_KERNEL_DEPS} dynload_mklml jit_kernel_mkl PARENT_SCOPE) 4 | 5 | # use mkl kernels by name and type 6 | USE_JITKERNEL_MORE(kMatMul, mkl) 7 | USE_JITKERNEL_MORE(kVMul, mkl) 8 | USE_JITKERNEL_MORE(kVAdd, mkl) 9 | USE_JITKERNEL_MORE(kVScal, mkl) 10 | USE_JITKERNEL_MORE(kVExp, mkl) 11 | USE_JITKERNEL_MORE(kVSquare, mkl) 12 | USE_JITKERNEL_MORE(kVCopy, mkl) 13 | USE_JITKERNEL_MORE(kVSigmoid, mkl) 14 | USE_JITKERNEL_MORE(kVTanh, mkl) 15 | USE_JITKERNEL_MORE(kSeqPool, mkl) 16 | USE_JITKERNEL_MORE(kSoftmax, mkl) 17 | USE_JITKERNEL_MORE(kEmbSeqPool, mkl) 18 | USE_JITKERNEL_MORE(kSgd, mkl) 19 | USE_JITKERNEL_MORE(kVBroadcast, mkl) 20 | -------------------------------------------------------------------------------- /python/paddle/fluid/inferencer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # NOTE: inferencer is moved into fluid.contrib.inferencer. 16 | __all__ = [] 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | cache: 3 | directories: 4 | - $HOME/.ccache 5 | - $HOME/.cache/pip 6 | - $TRAVIS_BUILD_DIR/build/third_party 7 | sudo: required 8 | dist: trusty 9 | services: 10 | - docker 11 | os: 12 | - linux 13 | env: 14 | - JOB=check_style 15 | addons: 16 | ssh_known_hosts: 13.229.163.131 17 | before_install: 18 | # For pylint dockstring checker 19 | - sudo pip install pylint pytest astroid isort 20 | - | 21 | function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; } 22 | script: 23 | - | 24 | # 43min timeout 25 | paddle/scripts/paddle_docker_build.sh ${JOB} 26 | if [ $? -eq 0 ] || [ $? -eq 142 ]; then true; else exit 1; fi; 27 | notifications: 28 | email: 29 | on_success: change 30 | on_failure: always 31 | -------------------------------------------------------------------------------- /paddle/fluid/memory/memory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | #include "paddle/fluid/memory/malloc.h" 18 | #include "paddle/fluid/memory/memcpy.h" 19 | -------------------------------------------------------------------------------- /paddle/fluid/inference/analysis/analysis_pass.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "paddle/fluid/inference/analysis/analysis_pass.h" 16 | -------------------------------------------------------------------------------- /paddle/scripts/installation_validate.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import paddle.fluid as fluid 16 | import paddle as pd 17 | 18 | print(pd.__version__) 19 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/reader/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | from . import ctr_reader 18 | 19 | __all__ = ctr_reader.__all__ 20 | -------------------------------------------------------------------------------- /paddle/fluid/platform/enforce.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/platform/enforce.h" 16 | 17 | namespace paddle { 18 | namespace platform {} // namespace platform 19 | } // namespace paddle 20 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/recognize_digits/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | # default test 5 | if(NOT APPLE) 6 | foreach(src ${TEST_OPS}) 7 | py_test(${src} SRCS ${src}.py) 8 | endforeach() 9 | else() 10 | foreach(src ${TEST_OPS}) 11 | if(${src} STREQUAL "test_recognize_digits_conv") 12 | message(WARNING "These tests has been disabled in OSX for random fail: \n" ${src}) 13 | elseif(${src} STREQUAL "test_recognize_digits_mlp") 14 | message(WARNING "These tests has been disabled in OSX for random fail: \n" ${src}) 15 | else() 16 | py_test(${src} SRCS ${src}.py) 17 | endif() 18 | endforeach() 19 | endif() 20 | -------------------------------------------------------------------------------- /python/paddle/proto/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from paddle.proto.TrainerConfig_pb2 import OptimizationConfig, TrainerConfig 16 | from paddle.proto.ModelConfig_pb2 import ModelConfig 17 | -------------------------------------------------------------------------------- /benchmark/fluid/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __all__ = [ 16 | "machine_translation", "resnet", "vgg", "mnist", "stacked_dynamic_lstm", 17 | "resnet_with_preprocess" 18 | ] 19 | -------------------------------------------------------------------------------- /paddle/scripts/docker/root/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = 3 | email = 4 | 5 | [alias] 6 | st = status --branch --short 7 | ci = commit 8 | br = branch 9 | co = checkout 10 | df = diff 11 | l = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short 12 | ll = log --stat 13 | 14 | [merge] 15 | tool = vimdiff 16 | 17 | [core] 18 | excludesfile = ~/.gitignore 19 | editor = vim 20 | 21 | [color] 22 | branch = auto 23 | diff = auto 24 | status = auto 25 | 26 | [color "branch"] 27 | current = yellow reverse 28 | local = yellow 29 | remote = green 30 | 31 | [color "diff"] 32 | meta = yellow bold 33 | frag = magenta bold 34 | old = red bold 35 | new = green bold 36 | 37 | [color "status"] 38 | added = yellow 39 | changed = green 40 | untracked = cyan 41 | 42 | [push] 43 | default = matching -------------------------------------------------------------------------------- /python/paddle/fluid/tests/book/high-level-api/image_classification/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") 2 | string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") 3 | 4 | if(NOT APPLE) 5 | # default test 6 | foreach(src ${TEST_OPS}) 7 | py_test(${src} SRCS ${src}.py) 8 | endforeach() 9 | else() 10 | foreach(src ${TEST_OPS}) 11 | if(${src} STREQUAL "test_image_classification_vgg") 12 | message(WARNING "These tests has been disabled in OSX for random fail: \n" ${src}) 13 | elseif(${src} STREQUAL "test_image_classification_resnet") 14 | message(WARNING "These tests has been disabled in OSX for random fail: \n" ${src}) 15 | elseif() 16 | py_test(${src} SRCS ${src}.py) 17 | endif() 18 | endforeach() 19 | endif() 20 | -------------------------------------------------------------------------------- /cmake/FindGlog.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Find libglog 3 | # 4 | # LIBGLOG_INCLUDE_DIR - where to find glog/logging.h, etc. 5 | # LIBGLOG_LIBRARY - List of libraries when using libglog. 6 | # LIBGLOG_FOUND - True if libglog found. 7 | # 8 | # from https://github.com/facebook/hhvm/blob/master/CMake/FindGlog.cmake 9 | 10 | IF (LIBGLOG_INCLUDE_DIR) 11 | # Already in cache, be silent 12 | SET(LIBGLOG_FIND_QUIETLY TRUE) 13 | ENDIF () 14 | 15 | FIND_PATH(LIBGLOG_INCLUDE_DIR glog/logging.h) 16 | 17 | FIND_LIBRARY(LIBGLOG_LIBRARY glog) 18 | 19 | # handle the QUIETLY and REQUIRED arguments and set LIBGLOG_FOUND to TRUE if 20 | # all listed variables are TRUE 21 | INCLUDE(FindPackageHandleStandardArgs) 22 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGLOG DEFAULT_MSG LIBGLOG_LIBRARY LIBGLOG_INCLUDE_DIR) 23 | 24 | MARK_AS_ADVANCED(LIBGLOG_LIBRARY LIBGLOG_INCLUDE_DIR) -------------------------------------------------------------------------------- /paddle/fluid/platform/dynload/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cc_library(dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags enforce) 2 | 3 | list(APPEND CUDA_SRCS cublas.cc cudnn.cc curand.cc) 4 | 5 | # There is no macOS version of NCCL. 6 | if (NOT APPLE AND NOT WIN32) 7 | list(APPEND CUDA_SRCS nccl.cc) 8 | endif() 9 | 10 | if (TENSORRT_FOUND) 11 | list(APPEND CUDA_SRCS tensorrt.cc) 12 | endif() 13 | 14 | configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h) 15 | if (CUPTI_FOUND) 16 | list(APPEND CUDA_SRCS cupti.cc) 17 | endif(CUPTI_FOUND) 18 | nv_library(dynload_cuda SRCS ${CUDA_SRCS} DEPS dynamic_loader) 19 | cc_library(dynload_warpctc SRCS warpctc.cc DEPS dynamic_loader warpctc) 20 | if (WITH_MKLML) 21 | cc_library(dynload_mklml SRCS mklml.cc DEPS dynamic_loader mklml) 22 | endif() 23 | # TODO(TJ): add iomp, mkldnn? 24 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/int8_inference/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | from . import utility 18 | from .utility import * 19 | 20 | __all__ = utility.__all__ 21 | -------------------------------------------------------------------------------- /paddle/fluid/operators/minus_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/minus_op.h" 16 | 17 | REGISTER_OP_CUDA_KERNEL( 18 | minus, 19 | paddle::operators::MinusKernel); 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | python/paddle/fluid/tests/unittests/reader_reset_test.recordio 2 | paddle/operators/check_t.save 3 | paddle/operators/check_tensor.ls 4 | paddle/operators/tensor.save 5 | python/paddle/v2/fluid/tests/book/image_classification_resnet.inference.model/ 6 | python/paddle/v2/fluid/tests/book/image_classification_vgg.inference.model/ 7 | python/paddle/v2/fluid/tests/book/label_semantic_roles.inference.model/ 8 | paddle/fluid/operators/distributed/send_recv.proto 9 | *.DS_Store 10 | *.vs 11 | build/ 12 | build_doc/ 13 | *.user 14 | 15 | .vscode 16 | .idea 17 | .project 18 | .cproject 19 | .pydevproject 20 | .settings/ 21 | CMakeSettings.json 22 | Makefile 23 | .test_env/ 24 | third_party/ 25 | 26 | *~ 27 | bazel-* 28 | third_party/ 29 | 30 | build_* 31 | # clion workspace. 32 | cmake-build-* 33 | paddle/fluid/operators/distributed/send_recv.proto 34 | model_test 35 | -------------------------------------------------------------------------------- /paddle/fluid/operators/dgc_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/dgc_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | 19 | REGISTER_OP_CUDA_KERNEL( 20 | dgc, ops::DGCOpKernel); 21 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/decoder/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | from . import beam_search_decoder 18 | from .beam_search_decoder import * 19 | 20 | __all__ = beam_search_decoder.__all__ 21 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/quantize/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | from . import quantize_transpiler 18 | from .quantize_transpiler import * 19 | 20 | __all__ = quantize_transpiler.__all__ 21 | -------------------------------------------------------------------------------- /python/paddle/fluid/transpiler/details/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | from .program_utils import * 18 | from .ufind import * 19 | from .checkport import * 20 | from .vars_distributed import * 21 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/ftrl_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | You may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. */ 13 | #include "paddle/fluid/operators/optimizers/ftrl_op.h" 14 | 15 | namespace ops = paddle::operators; 16 | REGISTER_OP_CUDA_KERNEL( 17 | ftrl, ops::FTRLOpKernel); 18 | -------------------------------------------------------------------------------- /benchmark/fluid/run_fluid_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PADDLE_TRAINING_ROLE=PSERVER PADDLE_PSERVER_PORT=7164 PADDLE_PSERVER_IPS=127.0.0.1 PADDLE_TRAINERS=2 PADDLE_CURRENT_IP=127.0.0.1 PADDLE_TRAINER_ID=0 python fluid_benchmark.py --model resnet --device CPU --update_method pserver --iterations=10000 & 4 | 5 | sleep 15 6 | 7 | CUDA_VISIBLE_DEVICES=0,1 PADDLE_TRAINING_ROLE=TRAINER PADDLE_PSERVER_PORT=7164 PADDLE_PSERVER_IPS=127.0.0.1 PADDLE_TRAINERS=2 PADDLE_CURRENT_IP=127.0.0.1 PADDLE_TRAINER_ID=0 python fluid_benchmark.py --model resnet --device GPU --update_method pserver --iterations=10000 --gpus 2 & 8 | 9 | CUDA_VISIBLE_DEVICES=2,3 PADDLE_TRAINING_ROLE=TRAINER PADDLE_PSERVER_PORT=7164 PADDLE_PSERVER_IPS=127.0.0.1 PADDLE_TRAINERS=2 PADDLE_CURRENT_IP=127.0.0.1 PADDLE_TRAINER_ID=1 python fluid_benchmark.py --model resnet --device GPU --update_method pserver --iterations=10000 --gpus 2 & 10 | -------------------------------------------------------------------------------- /paddle/fluid/platform/cpu_helper_test.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/platform/cpu_helper.h" 16 | 17 | #include "gtest/gtest.h" 18 | 19 | TEST(CpuHelper, SetNumThread) { 20 | paddle::platform::SetNumThreads(1); 21 | paddle::platform::SetNumThreads(4); 22 | } 23 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/slim/graph/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from . import executor 16 | from .executor import * 17 | from . import graph_wrapper 18 | from .graph_wrapper import * 19 | __all__ = executor.__all__ 20 | __all__ += graph_wrapper.__all__ 21 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/rmsprop_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/optimizers/rmsprop_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | rmsprop, ops::RmspropOpKernel); 19 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/slim/prune/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from . import pruner 16 | from .pruner import * 17 | from . import prune_strategy 18 | from .prune_strategy import * 19 | 20 | __all__ = pruner.__all__ 21 | __all__ += prune_strategy.__all__ 22 | -------------------------------------------------------------------------------- /paddle/fluid/inference/analysis/device.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #pragma once 15 | 16 | namespace paddle { 17 | namespace inference { 18 | namespace analysis { 19 | 20 | enum class Device { CPU, GPU }; 21 | 22 | } // namespace analysis 23 | } // namespace inference 24 | } // namespace paddle 25 | -------------------------------------------------------------------------------- /paddle/fluid/operators/clip_by_norm_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/clip_by_norm_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL( 19 | clip_by_norm, 20 | ops::ClipByNormKernel); 21 | -------------------------------------------------------------------------------- /paddle/fluid/imperative/profiler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | namespace paddle { 18 | namespace imperative { 19 | 20 | extern void StartProfile(); 21 | 22 | extern void StopProfile(); 23 | 24 | } // namespace imperative 25 | } // namespace paddle 26 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/proximal_gd_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | You may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. */ 13 | #include "paddle/fluid/operators/optimizers/proximal_gd_op.h" 14 | 15 | namespace ops = paddle::operators; 16 | REGISTER_OP_CUDA_KERNEL( 17 | proximal_gd, 18 | ops::ProximalGDOpKernel); 19 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_mean_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import print_function 15 | 16 | import unittest 17 | from paddle.fluid.tests.unittests.test_mean_op import TestMeanOp 18 | 19 | if __name__ == "__main__": 20 | unittest.main() 21 | -------------------------------------------------------------------------------- /paddle/fluid/operators/assign_value_op.cu.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | Indicesou may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/assign_value_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL(assign_value, ops::AssignValueKernel, 19 | ops::AssignValueKernel); 20 | -------------------------------------------------------------------------------- /paddle/fluid/pybind/inference_api.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include 18 | 19 | namespace paddle { 20 | namespace pybind { 21 | void BindInferenceApi(pybind11::module *m); 22 | } // namespace pybind 23 | } // namespace paddle 24 | -------------------------------------------------------------------------------- /paddle/fluid/operators/dgc_clip_by_norm_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/dgc_clip_by_norm_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL( 19 | dgc_clip_by_norm, 20 | ops::DGCClipByNormKernel); 21 | -------------------------------------------------------------------------------- /paddle/fluid/platform/hostdevice.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #pragma once 15 | 16 | #ifdef __CUDACC__ 17 | #define HOSTDEVICE __host__ __device__ 18 | #define DEVICE __device__ 19 | #define HOST __host__ 20 | #else 21 | #define HOSTDEVICE 22 | #define DEVICE 23 | #define HOST 24 | #endif 25 | -------------------------------------------------------------------------------- /paddle/fluid/pybind/reader_py.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "pybind11/pybind11.h" 18 | 19 | namespace paddle { 20 | namespace pybind { 21 | 22 | void BindReader(pybind11::module *module); 23 | 24 | } // namespace pybind 25 | } // namespace paddle 26 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_softmax_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | import unittest 17 | from paddle.fluid.tests.unittests.test_softmax_op import TestSoftmaxOp 18 | 19 | if __name__ == "__main__": 20 | unittest.main() 21 | -------------------------------------------------------------------------------- /cmake/external/dlpack.cmake: -------------------------------------------------------------------------------- 1 | include(ExternalProject) 2 | 3 | set(DLPACK_SOURCE_DIR ${THIRD_PARTY_PATH}/dlpack) 4 | set(DLPACK_INCLUDE_DIR ${DLPACK_SOURCE_DIR}/src/extern_dlpack/include) 5 | 6 | include_directories(${DLPACK_INCLUDE_DIR}) 7 | 8 | ExternalProject_Add( 9 | extern_dlpack 10 | ${EXTERNAL_PROJECT_LOG_ARGS} 11 | GIT_REPOSITORY "https://github.com/dmlc/dlpack.git" 12 | GIT_TAG "v0.2" 13 | PREFIX ${DLPACK_SOURCE_DIR} 14 | UPDATE_COMMAND "" 15 | CONFIGURE_COMMAND "" 16 | BUILD_COMMAND "" 17 | INSTALL_COMMAND "" 18 | TEST_COMMAND "" 19 | ) 20 | 21 | if(${CMAKE_VERSION} VERSION_LESS "3.3.0") 22 | set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/dlpack_dummy.c) 23 | file(WRITE ${dummyfile} "const char *dummy = \"${dummyfile}\";") 24 | add_library(dlpack STATIC ${dummyfile}) 25 | else() 26 | add_library(dlpack INTERFACE) 27 | endif() 28 | 29 | add_dependencies(dlpack extern_dlpack) 30 | -------------------------------------------------------------------------------- /paddle/fluid/operators/distributed_ops/split_byref_op.cu.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/distributed_ops/split_byref_op.h" 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | split_byref, 19 | ops::SplitByrefOpKernel); 20 | -------------------------------------------------------------------------------- /paddle/fluid/operators/reduce_ops/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(operators) 2 | if(WITH_GPU) 3 | register_operators(DEPS cub) 4 | else() 5 | register_operators() 6 | endif() 7 | 8 | if(WITH_GPU) 9 | file(GLOB OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.part.cu") 10 | string(REPLACE ".part.cu" "" OPS "${OPS}") 11 | 12 | foreach(src ${OPS}) 13 | if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${src}.part.cu) 14 | set(CUDA_KERNEL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${src}.part.cu) 15 | file(READ ${CUDA_KERNEL_FILE} TARGET_CONTENT) 16 | string(REGEX MATCH "REGISTER_OP_CUDA_KERNEL\\(\\n?([^,]+),.*" MATCHED ${TARGET_CONTENT}) 17 | if (MATCHED) 18 | string(STRIP ${CMAKE_MATCH_1} MATCHED) 19 | file(APPEND ${pybind_file} "USE_OP_DEVICE_KERNEL(${MATCHED}, CUDA);\n") 20 | endif() 21 | 22 | endif() 23 | endforeach() 24 | endif() 25 | -------------------------------------------------------------------------------- /paddle/fluid/operators/split_selected_rows_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/split_selected_rows_op.h" 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | split_selected_rows, 19 | ops::SplitSelectedRowsOpKernel); 20 | -------------------------------------------------------------------------------- /paddle/fluid/platform/cpu_helper.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | #include 18 | 19 | namespace paddle { 20 | namespace platform { 21 | 22 | //! Set the number of threads in use. 23 | void SetNumThreads(int num_threads); 24 | 25 | } // namespace platform 26 | } // namespace paddle 27 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_mul_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_mul_op import TestMulOp, TestMulOp2 19 | 20 | if __name__ == "__main__": 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /paddle/fluid/framework/variable_helper.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #pragma once 15 | 16 | #include "paddle/fluid/framework/framework.pb.h" 17 | #include "paddle/fluid/framework/variable.h" 18 | namespace paddle { 19 | namespace framework { 20 | void InitializeVariable(Variable *var, proto::VarType::Type var_type); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/proximal_adagrad_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | You may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. */ 13 | #include "paddle/fluid/operators/optimizers/proximal_adagrad_op.h" 14 | 15 | namespace ops = paddle::operators; 16 | REGISTER_OP_CUDA_KERNEL( 17 | proximal_adagrad, 18 | ops::ProximalAdagradOpKernel); 19 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/slim/distillation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from . import distiller 16 | from .distiller import * 17 | from . import distillation_strategy 18 | from .distillation_strategy import * 19 | 20 | __all__ = distiller.__all__ 21 | __all__ += distillation_strategy.__all__ 22 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_accuracy_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_accuracy_op import TestAccuracyOp 19 | 20 | if __name__ == '__main__': 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_scale_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import print_function 15 | import unittest 16 | from paddle.fluid.tests.unittests.test_scale_op import TestScaleOp, TestScaleOpSelectedRows 17 | 18 | if __name__ == "__main__": 19 | unittest.main() 20 | -------------------------------------------------------------------------------- /benchmark/caffe/image/run.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | function test() { 4 | cfg=$1 5 | batch=$2 6 | prefix=$3 7 | sed -i "/input: \"data\"/{n;s/^input_dim.*/input_dim: $batch/g}" $cfg 8 | sed -i "/input: \"label\"/{n;s/^input_dim.*/input_dim: $batch/g}" $cfg 9 | caffe time --model=$cfg --iterations=50 --gpu 0 > logs/$prefix-1gpu-batch${batch}.log 2>&1 10 | } 11 | 12 | if [ ! -d "logs" ]; then 13 | mkdir logs 14 | fi 15 | 16 | # alexnet 17 | test alexnet.prototxt 64 alexnet 18 | test alexnet.prototxt 128 alexnet 19 | test alexnet.prototxt 256 alexnet 20 | test alexnet.prototxt 512 alexnet 21 | 22 | # googlenet 23 | test googlenet.prototxt 64 googlenet 24 | test googlenet.prototxt 128 googlenet 25 | 26 | # small net 27 | test smallnet_mnist_cifar.prototxt 64 smallnet 28 | test smallnet_mnist_cifar.prototxt 128 smallnet 29 | test smallnet_mnist_cifar.prototxt 256 smallnet 30 | test smallnet_mnist_cifar.prototxt 512 smallnet 31 | -------------------------------------------------------------------------------- /cmake/external/cub.cmake: -------------------------------------------------------------------------------- 1 | if(NOT WITH_GPU) 2 | return() 3 | endif() 4 | 5 | include(ExternalProject) 6 | 7 | set(CUB_SOURCE_DIR ${THIRD_PARTY_PATH}/cub) 8 | set(CUB_INCLUDE_DIR ${CUB_SOURCE_DIR}/src/extern_cub) 9 | 10 | include_directories(${CUB_INCLUDE_DIR}) 11 | 12 | ExternalProject_Add( 13 | extern_cub 14 | ${EXTERNAL_PROJECT_LOG_ARGS} 15 | GIT_REPOSITORY "https://github.com/NVlabs/cub.git" 16 | GIT_TAG "v1.8.0" 17 | PREFIX ${CUB_SOURCE_DIR} 18 | UPDATE_COMMAND "" 19 | CONFIGURE_COMMAND "" 20 | BUILD_COMMAND "" 21 | INSTALL_COMMAND "" 22 | TEST_COMMAND "" 23 | ) 24 | 25 | if(${CMAKE_VERSION} VERSION_LESS "3.3.0") 26 | set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/cub_dummy.c) 27 | file(WRITE ${dummyfile} "const char *dummy = \"${dummyfile}\";") 28 | add_library(cub STATIC ${dummyfile}) 29 | else() 30 | add_library(cub INTERFACE) 31 | endif() 32 | 33 | add_dependencies(cub extern_cub) 34 | -------------------------------------------------------------------------------- /paddle/fluid/inference/analysis/passes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cc_library(ir_graph_build_pass SRCS ir_graph_build_pass.cc DEPS analysis_pass argument ir_pass_manager) 2 | cc_library(ir_analysis_pass SRCS ir_analysis_pass.cc DEPS analysis_pass argument ir_pass_manager) 3 | cc_library(memory_optim_pass SRCS memory_optimize_pass.cc DEPS analysis_pass zero_copy_tensor) 4 | cc_library(ir_params_sync_among_devices_pass SRCS ir_params_sync_among_devices_pass.cc DEPS analysis_pass argument ir_pass_manager) 5 | cc_library(ir_graph_to_program_pass SRCS ir_graph_to_program_pass.cc DEPS analysis_pass graph_to_program_pass) 6 | 7 | cc_library(analysis_passes SRCS passes.cc DEPS 8 | ir_graph_build_pass 9 | ir_analysis_pass 10 | ir_params_sync_among_devices_pass 11 | memory_optim_pass 12 | ir_graph_to_program_pass 13 | ) 14 | 15 | set(analysis_deps ${analysis_deps} 16 | analysis_passes 17 | subgraph_detector 18 | CACHE INTERNAL "") 19 | -------------------------------------------------------------------------------- /paddle/fluid/inference/api/demo_ci/windows_inference.md: -------------------------------------------------------------------------------- 1 | # windows inference 2 | 本文介绍windows inference,目前只提供了静态编译,编译出paddle_fluid.lib,包含了除openblas.dll之外的所有第三方依赖库。 3 | 4 | 1. 下载最新的paddle_fluid.lib和openblas.dll,并把它们放在同一个目录下。 5 | 6 | 2. 准备预训练好的模型文件,例如models中的模型,可以将模型用safe_inference_model接口保存下来。将模型文件放到该目录下 7 | 8 | 3. 进入Paddle/paddle/fluid/inference/api/demo_ci目录,新建build目录,然后使用cmake生成vs2015的solution文件。 9 | 其中PADDLE_LIB是前面的paddle_fluid.lib对应文件夹, CUDA_LIB指定为x64格式下的cuda系统库目录文件夹。 10 | ```shell 11 | cmake .. -G "Visual Studio 14 2015 Win64" -DWITH_GPU=ON -DWITH_MKL=OFF -DWITH_STATIC_LIB=ON -DCMAKE_BUILD_TYPE=Release -DDEMO_NAME=inference_icnet -DPADDLE_LIB=D:\to_the_paddle_fluid.lib -DCUDA_LIB=D:\tools\v8.0\lib\x64 12 | ``` 13 | 然后用vs2015打开对应的项目文件,注意使用静态链接 "/MT",生成对应的exe。将openblas.dll放到exe所在目录。 14 | 15 | 4. 该exe即为项目生成文件,可绑定运行。 16 | 17 | ## FAQ 18 | 1. cmake需要您手动下载,并添加到系统路径里 19 | 2. 路径中的不要包含空格,例如发现CUDA_LIB路径是Program Files(x86)可能会出错。可以将CUDA拷贝到一个新位置。 20 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/decayed_adagrad_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/optimizers/decayed_adagrad_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | decayed_adagrad, 19 | ops::DecayedAdagradOpKernel); 20 | -------------------------------------------------------------------------------- /paddle/fluid/operators/sampling_id_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/sampling_id_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL(sampling_id, paddle::operators::SamplingIdKernel, 19 | paddle::operators::SamplingIdKernel); 20 | -------------------------------------------------------------------------------- /paddle/fluid/framework/details/multi_devices_helper.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #include "paddle/fluid/framework/details/multi_devices_helper.h" 15 | 16 | namespace paddle { 17 | namespace framework { 18 | namespace details {} // namespace details 19 | } // namespace framework 20 | } // namespace paddle 21 | -------------------------------------------------------------------------------- /paddle/fluid/framework/lod_tensor_array.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | #include 17 | #include "paddle/fluid/framework/lod_tensor.h" 18 | 19 | namespace paddle { 20 | namespace framework { 21 | 22 | using LoDTensorArray = std::vector; 23 | 24 | } // namespace framework 25 | } // namespace paddle 26 | -------------------------------------------------------------------------------- /paddle/fluid/inference/api/details/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | cc_library(reset_tensor_array SRCS reset_tensor_array.cc DEPS lod_tensor scope) 17 | cc_library(zero_copy_tensor SRCS zero_copy_tensor.cc DEPS scope lod_tensor enforce) 18 | cc_library(zero_copy_tensor_dummy SRCS zero_copy_tensor_dummy.cc) 19 | -------------------------------------------------------------------------------- /paddle/fluid/string/pretty_log.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "paddle/fluid/string/pretty_log.h" 16 | #include 17 | 18 | DEFINE_bool(color, true, "Whether to turn on pretty log"); 19 | 20 | namespace paddle { 21 | namespace string {} // namespace string 22 | } // namespace paddle 23 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/slim/core/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from . import config 16 | from .config import * 17 | from . import compressor 18 | from .compressor import * 19 | from . import strategy 20 | from .strategy import * 21 | 22 | __all__ = config.__all__ + compressor.__all__ + strategy.__all__ 23 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/test_install_check.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | import unittest 17 | import paddle.fluid as fluid 18 | 19 | 20 | class TestInstallCheck(unittest.TestCase): 21 | def test_install_check(self): 22 | fluid.install_check.run_check() 23 | -------------------------------------------------------------------------------- /tools/codestyle/cpplint_pre_commit.hook: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TOTAL_ERRORS=0 4 | if [[ ! $TRAVIS_BRANCH ]]; then 5 | # install cpplint on local machine. 6 | if [[ ! $(which cpplint) ]]; then 7 | pip install cpplint 8 | fi 9 | # diff files on local machine. 10 | files=$(git diff --cached --name-status | awk '$1 != "D" {print $2}') 11 | else 12 | # diff files between PR and latest commit on Travis CI. 13 | branch_ref=$(git rev-parse "$TRAVIS_BRANCH") 14 | head_ref=$(git rev-parse HEAD) 15 | files=$(git diff --name-status $branch_ref $head_ref | awk '$1 != "D" {print $2}') 16 | fi 17 | # The trick to remove deleted files: https://stackoverflow.com/a/2413151 18 | for file in $files; do 19 | if [[ $file =~ ^(patches/grpc/.*) ]]; then 20 | continue; 21 | else 22 | cpplint --filter=-readability/fn_size $file; 23 | TOTAL_ERRORS=$(expr $TOTAL_ERRORS + $?); 24 | fi 25 | done 26 | 27 | exit $TOTAL_ERRORS 28 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | # This file is used by clang-format to autoformat paddle source code 2 | # 3 | # The clang-format is part of llvm toolchain. 4 | # It need to install llvm and clang to format source code style. 5 | # 6 | # The basic usage is, 7 | # clang-format -i -style=file PATH/TO/SOURCE/CODE 8 | # 9 | # The -style=file implicit use ".clang-format" file located in one of 10 | # parent directory. 11 | # The -i means inplace change. 12 | # 13 | # The document of clang-format is 14 | # http://clang.llvm.org/docs/ClangFormat.html 15 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html 16 | --- 17 | Language: Cpp 18 | BasedOnStyle: Google 19 | IndentWidth: 2 20 | TabWidth: 2 21 | ContinuationIndentWidth: 4 22 | AccessModifierOffset: -1 # The private/protected/public has no indent in class 23 | Standard: Cpp11 24 | AllowAllParametersOfDeclarationOnNextLine: true 25 | BinPackParameters: false 26 | BinPackArguments: false 27 | ... 28 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_concat_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_concat_op import TestConcatOp, TestConcatOp2, TestConcatOp3 19 | 20 | if __name__ == '__main__': 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/adam_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/optimizers/adam_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | adam, ops::AdamOpKernel, 19 | ops::AdamOpKernel); 20 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_sum_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import print_function 15 | import unittest 16 | from paddle.fluid.tests.unittests.test_sum_op import TestSumOp, TestSelectedRowsSumOp, TestLoDTensorAndSelectedRowsOp 17 | 18 | if __name__ == "__main__": 19 | unittest.main() 20 | -------------------------------------------------------------------------------- /paddle/fluid/pybind/exception.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "paddle/fluid/platform/enforce.h" 19 | #include "pybind11/pybind11.h" 20 | 21 | namespace paddle { 22 | namespace pybind { 23 | 24 | void BindException(pybind11::module* m); 25 | 26 | } // namespace pybind 27 | } // namespace paddle 28 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/adamax_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/optimizers/adamax_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | adamax, ops::AdamaxOpKernel, 19 | ops::AdamaxOpKernel); 20 | -------------------------------------------------------------------------------- /paddle/fluid/pybind/const_value.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "paddle/fluid/platform/enforce.h" 19 | #include "pybind11/pybind11.h" 20 | 21 | namespace paddle { 22 | namespace pybind { 23 | 24 | void BindConstValue(pybind11::module* m); 25 | 26 | } // namespace pybind 27 | } // namespace paddle 28 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_batch_norm_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_batch_norm_op import TestBatchNormOpTraining, TestBatchNormOpInference 19 | 20 | if __name__ == '__main__': 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_top_k_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from __future__ import print_function 15 | 16 | import unittest 17 | from paddle.fluid.tests.unittests.test_top_k_op import TestTopkOp, TestTopkOp3d, TestTopkOp2, TestTopkOp3, TestTopkOp4 18 | 19 | if __name__ == "__main__": 20 | unittest.main() 21 | -------------------------------------------------------------------------------- /paddle/fluid/operators/pad_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/pad_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | pad, ops::PadKernel); 19 | REGISTER_OP_CUDA_KERNEL( 20 | pad_grad, ops::PadGradKernel); 21 | -------------------------------------------------------------------------------- /paddle/fluid/operators/crop_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/crop_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | crop, ops::CropKernel); 19 | REGISTER_OP_CUDA_KERNEL( 20 | crop_grad, ops::CropGradKernel); 21 | -------------------------------------------------------------------------------- /paddle/fluid/operators/optimizers/adadelta_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/optimizers/adadelta_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | adadelta, ops::AdadeltaOpKernel, 19 | ops::AdadeltaOpKernel); 20 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | from . import lookup_table_utils 17 | from .lookup_table_utils import * 18 | from . import hdfs_utils 19 | from .hdfs_utils import * 20 | 21 | __all__ = [] 22 | __all__ += lookup_table_utils.__all__ 23 | __all__ += hdfs_utils.__all__ 24 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_adam_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_adam_op import TestAdamOp1, TestAdamOp2, TestAdamOpMultipleSteps, TestSparseAdamOp 19 | 20 | if __name__ == "__main__": 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /paddle/fluid/operators/clip_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/clip_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL( 19 | clip, ops::ClipKernel); 20 | REGISTER_OP_CUDA_KERNEL( 21 | clip_grad, ops::ClipGradKernel); 22 | -------------------------------------------------------------------------------- /paddle/fluid/operators/py_func_op.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | #include "paddle/fluid/framework/python_headers.h" 17 | 18 | namespace paddle { 19 | namespace operators { 20 | 21 | size_t AppendPythonCallableObjectAndReturnId(const ::pybind11::object &py_obj); 22 | 23 | } // namespace operators 24 | } // namespace paddle 25 | -------------------------------------------------------------------------------- /paddle/fluid/pybind/recordio.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | #include "pybind11/pybind11.h" 17 | #include "pybind11/stl.h" 18 | 19 | namespace py = pybind11; 20 | 21 | namespace paddle { 22 | namespace pybind { 23 | 24 | void BindRecordIOWriter(py::module* m); 25 | 26 | } // namespace pybind 27 | } // namespace paddle 28 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_elementwise_add_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_elementwise_add_op import TestElementwiseAddOp, TestElementwiseAddOp_broadcast_0 19 | 20 | if __name__ == '__main__': 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /cmake/FindJeMalloc.cmake: -------------------------------------------------------------------------------- 1 | # - Find JeMalloc library 2 | # Find the native JeMalloc includes and library 3 | # 4 | # JEMALLOC_INCLUDE_DIR - where to find jemalloc.h, etc. 5 | # JEMALLOC_LIBRARIES - List of libraries when using jemalloc. 6 | # JEMALLOC_FOUND - True if jemalloc found. 7 | 8 | find_path(JEMALLOC_INCLUDE_DIR 9 | NAMES jemalloc/jemalloc.h 10 | HINTS ${JEMALLOC_ROOT_DIR}/include) 11 | 12 | find_library(JEMALLOC_LIBRARIES 13 | NAMES jemalloc 14 | HINTS ${JEMALLOC_ROOT_DIR}/lib) 15 | 16 | include(FindPackageHandleStandardArgs) 17 | find_package_handle_standard_args(jemalloc DEFAULT_MSG JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR) 18 | 19 | mark_as_advanced( 20 | JEMALLOC_LIBRARIES 21 | JEMALLOC_INCLUDE_DIR) 22 | 23 | if (JEMALLOC_FOUND) 24 | add_library(jemalloc::jemalloc UNKNOWN IMPORTED) 25 | set_target_properties(jemalloc::jemalloc PROPERTIES 26 | IMPORTED_LOCATION ${JEMALLOC_LIBRARIES} 27 | INTERFACE_INCLUDE_DIRECTORIES "${JEMALLOC_INCLUDE_DIR}") 28 | endif() 29 | -------------------------------------------------------------------------------- /cmake/package.cmake: -------------------------------------------------------------------------------- 1 | set(CPACK_PACKAGE_NAME paddle) 2 | set(CPACK_PACKAGE_VERSION_MAJOR ${PADDLE_MAJOR_VERSION}) 3 | set(CPACK_PACKAGE_VERSION_MINOR ${PADDLE_MINOR_VERSION}) 4 | set(CPACK_PACKAGE_VERSION_PATCH ${PADDLE_PATCH_VERSION}) 5 | set(CPACK_PACKAGE_VERSION ${PADDLE_VERSION}) 6 | ## DEB Settings 7 | set(CPACK_DEBIAN_PACKAGE_NAME paddle) 8 | set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) 9 | set(CPACK_DEBIAN_PACKAGE_MAINTAINER PaddlePaddle Dev ) 10 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Paddle") 11 | set(CPACK_PACKAGE_DESCRIPTION "") 12 | set(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython2.7-dev, libstdc++6, python-pip, curl, libgfortran3, python-pip-whl") 13 | set(CPACK_DEBIAN_PACKAGE_SECTION Devel) 14 | set(CPACK_DEBIAN_PACKAGE_VERSION ${PADDLE_VERSION}) 15 | set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PADDLE_SOURCE_DIR}/paddle/scripts/deb/postinst") 16 | #set(CPACK_GENERATOR "DEB") 17 | # Start cpack 18 | include (CMakePackageConfigHelpers) 19 | include (CPack) 20 | 21 | 22 | -------------------------------------------------------------------------------- /paddle/fluid/pybind/ir.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include 18 | #include "paddle/fluid/framework/ir/graph.h" 19 | 20 | namespace paddle { 21 | namespace pybind { 22 | void BindGraph(pybind11::module *m); 23 | void BindNode(pybind11::module *m); 24 | } // namespace pybind 25 | } // namespace paddle 26 | -------------------------------------------------------------------------------- /paddle/fluid/framework/prune.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | #include "paddle/fluid/framework/framework.pb.h" 18 | #include "paddle/fluid/platform/enforce.h" 19 | 20 | namespace paddle { 21 | namespace framework { 22 | 23 | void Prune(const proto::ProgramDesc& input, proto::ProgramDesc* output); 24 | 25 | } // namespace framework 26 | } // namespace paddle 27 | -------------------------------------------------------------------------------- /python/paddle/fluid/contrib/slim/quantization/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | from . import quantization_pass 18 | from .quantization_pass import * 19 | from . import quantization_strategy 20 | from .quantization_strategy import * 21 | 22 | __all__ = quantization_pass.__all__ + quantization_strategy.__all__ 23 | -------------------------------------------------------------------------------- /paddle/fluid/pybind/async_executor_py.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "pybind11/pybind11.h" 18 | #include "pybind11/stl.h" 19 | 20 | namespace py = pybind11; 21 | 22 | namespace paddle { 23 | namespace pybind { 24 | 25 | void BindAsyncExecutor(py::module* m); 26 | 27 | } // namespace pybind 28 | } // namespace paddle 29 | -------------------------------------------------------------------------------- /paddle/fluid/operators/cos_sim_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/cos_sim_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | cos_sim, ops::CosSimKernel); 19 | REGISTER_OP_CUDA_KERNEL( 20 | cos_sim_grad, 21 | ops::CosSimGradKernel); 22 | -------------------------------------------------------------------------------- /paddle/fluid/operators/l1_norm_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/l1_norm_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | l1_norm, ops::L1NormKernel); 19 | REGISTER_OP_CUDA_KERNEL( 20 | l1_norm_grad, 21 | ops::L1NormGradKernel); 22 | -------------------------------------------------------------------------------- /paddle/fluid/operators/shape_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/shape_op.h" 16 | 17 | REGISTER_OP_CUDA_KERNEL(shape, paddle::operators::ShapeKernel, 18 | paddle::operators::ShapeKernel, 19 | paddle::operators::ShapeKernel, 20 | paddle::operators::ShapeKernel); 21 | -------------------------------------------------------------------------------- /paddle/fluid/operators/sync_batch_norm_op.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/batch_norm_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OPERATOR(sync_batch_norm, ops::BatchNormOp, ops::BatchNormOpMaker, 19 | ops::BatchNormOpInferVarType, ops::BatchNormGradMaker); 20 | REGISTER_OPERATOR(sync_batch_norm_grad, ops::BatchNormGradOp); 21 | -------------------------------------------------------------------------------- /paddle/fluid/platform/cuda_device_guard.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "paddle/fluid/platform/cuda_device_guard.h" 16 | 17 | namespace paddle { 18 | namespace platform { 19 | // Even this source file does not contains any code, it is better to keep this 20 | // source file for cmake dependency. 21 | } // namespace platform 22 | } // namespace paddle 23 | -------------------------------------------------------------------------------- /paddle/fluid/operators/elementwise/elementwise_pow_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | http://www.apache.org/licenses/LICENSE-2.0 6 | Unless required by applicable law or agreed to in writing, software 7 | distributed under the License is distributed on an "AS IS" BASIS, 8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | See the License for the specific language governing permissions and 10 | limitations under the License. */ 11 | #include "paddle/fluid/operators/elementwise/elementwise_pow_op.h" 12 | 13 | namespace ops = paddle::operators; 14 | 15 | REGISTER_OP_CUDA_KERNEL( 16 | elementwise_pow, 17 | ops::ElementwisePowKernel, 18 | ops::ElementwisePowKernel); 19 | -------------------------------------------------------------------------------- /paddle/fluid/operators/log_loss_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/log_loss_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | log_loss, ops::LogLossKernel); 19 | REGISTER_OP_CUDA_KERNEL( 20 | log_loss_grad, 21 | ops::LogLossGradKernel); 22 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_conv2d_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_conv2d_op import TestConv2dOp, TestWithPad, TestWithStride, TestWithGroup, TestWith1x1, TestWithInput1x1Filter1x1 19 | 20 | if __name__ == '__main__': 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /paddle/fluid/operators/detection/iou_similarity_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/detection/iou_similarity_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL( 19 | iou_similarity, 20 | ops::IOUSimilarityKernel, 21 | ops::IOUSimilarityKernel); 22 | -------------------------------------------------------------------------------- /paddle/fluid/operators/warpctc_op.cu.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/warpctc_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL( 19 | warpctc, ops::WarpCTCKernel); 20 | REGISTER_OP_CUDA_KERNEL( 21 | warpctc_grad, 22 | ops::WarpCTCGradKernel); 23 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_momentum_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_momentum_op import TestMomentumOp1, TestMomentumOp2, TestLarsMomentumOp, TestSparseMomentumOp, TestSparseMomentumOp2 19 | 20 | if __name__ == '__main__': 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /paddle/fluid/framework/proto_desc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | namespace paddle { 18 | namespace framework { 19 | 20 | // The Index of first Block in Program. also called root block. 21 | constexpr int kRootBlockIndex = 0; 22 | // The Parent Index of root Block, this block does not exist. 23 | constexpr int kNoneBlockIndex = -1; 24 | 25 | } // namespace framework 26 | } // namespace paddle 27 | -------------------------------------------------------------------------------- /paddle/fluid/inference/api/demo_ci/README.md: -------------------------------------------------------------------------------- 1 | # Inference Demos 2 | 3 | There are several demos: 4 | 5 | - simple_on_word2vec: 6 | - Follow the C++ codes is in `simple_on_word2vec.cc`. 7 | - It is suitable for word2vec model. 8 | - vis_demo: 9 | - Follow the C++ codes is in `vis_demo.cc`. 10 | - It is suitable for mobilenet, se_resnext50 and ocr three models. 11 | - Input data format: 12 | - Each line contains a single record 13 | - Each record's format is 14 | ``` 15 | \t 16 | ``` 17 | 18 | To build and execute the demos, simply run 19 | ``` 20 | ./run.sh $PADDLE_ROOT $TURN_ON_MKL $TEST_GPU_CPU 21 | ``` 22 | - It will build and execute the demos in both static and shared library. 23 | - `$PADDLE_ROOT`: paddle library path 24 | - `$TURN_ON_MKL`: use MKL or Openblas 25 | - `$TEST_GPU_CPU`: test both GPU/CPU mode or only CPU mode 26 | - NOTE: for simple_on_word2vec, must run `ctest -R test_word2vec -R` to obtain word2vec model at first. 27 | -------------------------------------------------------------------------------- /paddle/fluid/operators/hinge_loss_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/hinge_loss_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | hinge_loss, 19 | ops::HingeLossKernel); 20 | REGISTER_OP_CUDA_KERNEL( 21 | hinge_loss_grad, 22 | ops::HingeLossGradKernel); 23 | -------------------------------------------------------------------------------- /paddle/fluid/operators/huber_loss_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/huber_loss_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | huber_loss, 19 | ops::HuberLossKernel); 20 | REGISTER_OP_CUDA_KERNEL( 21 | huber_loss_grad, 22 | ops::HuberLossGradKernel); 23 | -------------------------------------------------------------------------------- /paddle/fluid/inference/analysis/flags.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | // TODO(Superjomn) add a definition flag like PADDLE_WITH_TENSORRT and hide this 18 | // flag if not available. 19 | DECLARE_bool(IA_enable_tensorrt_subgraph_engine); 20 | DECLARE_string(IA_graphviz_log_root); 21 | DECLARE_string(IA_output_storage_path); 22 | DECLARE_bool(IA_enable_ir); 23 | -------------------------------------------------------------------------------- /cmake/anakin_subgraph.cmake: -------------------------------------------------------------------------------- 1 | if(NOT WITH_GPU) 2 | return() 3 | endif() 4 | 5 | set(ANAKIN_ROOT "/usr" CACHE PATH "ANAKIN ROOT") 6 | find_path(ANAKIN_INCLUDE_DIR anakin_config.h 7 | PATHS ${ANAKIN_ROOT} ${ANAKIN_ROOT}/include 8 | $ENV{ANAKIN_ROOT} $ENV{ANAKIN_ROOT}/include 9 | NO_DEFAULT_PATH 10 | ) 11 | 12 | find_library(ANAKIN_LIBRARY NAMES libanakin_saber_common.so libanakin.so 13 | PATHS ${ANAKIN_ROOT} 14 | $ENV{ANAKIN_ROOT} $ENV{ANAKIN_ROOT}/lib 15 | NO_DEFAULT_PATH 16 | DOC "Path to ANAKIN library.") 17 | 18 | if(ANAKIN_INCLUDE_DIR AND ANAKIN_LIBRARY) 19 | if(WITH_DSO) 20 | set(ANAKIN_FOUND ON) 21 | endif(WITH_DSO) 22 | else() 23 | set(ANAKIN_FOUND OFF) 24 | endif() 25 | 26 | if(ANAKIN_FOUND) 27 | message(STATUS "Current ANAKIN header is ${ANAKIN_INCLUDE_DIR}/anakin_config.h. ") 28 | include_directories(${ANAKIN_ROOT}/include) 29 | include_directories(${ANAKIN_ROOT}/include/saber) 30 | link_directories(${ANAKIN_ROOT}) 31 | add_definitions(-DPADDLE_WITH_ANAKIN) 32 | endif() 33 | -------------------------------------------------------------------------------- /paddle/fluid/framework/ir/is_test_pass.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | #include "paddle/fluid/framework/ir/pass.h" 18 | 19 | namespace paddle { 20 | namespace framework { 21 | namespace ir { 22 | 23 | class IsTestPass : public Pass { 24 | protected: 25 | void ApplyImpl(ir::Graph* graph) const override; 26 | }; 27 | 28 | } // namespace ir 29 | } // namespace framework 30 | } // namespace paddle 31 | -------------------------------------------------------------------------------- /paddle/fluid/operators/clip_by_norm_op.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/clip_by_norm_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_WITHOUT_GRADIENT(clip_by_norm, ops::ClipByNormOp, 19 | ops::ClipByNormOpMaker); 20 | 21 | REGISTER_OP_CPU_KERNEL( 22 | clip_by_norm, 23 | ops::ClipByNormKernel); 24 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_softmax_with_cross_entropy_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | import unittest 17 | from paddle.fluid.tests.unittests.test_softmax_with_cross_entropy_op import TestSoftmaxWithCrossEntropyOp, TestSoftmaxWithCrossEntropyOp2, TestSoftmaxWithCrossEntropyOp3 18 | 19 | if __name__ == "__main__": 20 | unittest.main() 21 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/test_create_op_doc_string.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | import paddle.fluid.layers as layers 19 | 20 | 21 | class TestDocString(unittest.TestCase): 22 | def test_layer_doc_string(self): 23 | print(layers.dropout.__doc__) 24 | 25 | 26 | if __name__ == '__main__': 27 | unittest.main() 28 | -------------------------------------------------------------------------------- /tools/manylinux1/build_scripts/python-tag-abi-tag.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Utility script to print the python tag + the abi tag for a Python 16 | # See PEP 425 for exactly what these are, but an example would be: 17 | # cp27-cp27mu 18 | 19 | from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag 20 | 21 | print("{0}{1}-{2}".format(get_abbr_impl(), get_impl_ver(), get_abi_tag())) 22 | -------------------------------------------------------------------------------- /go/glide.yaml: -------------------------------------------------------------------------------- 1 | package: github.com/PaddlePaddle/Paddle/go 2 | import: 3 | - package: github.com/PaddlePaddle/recordio 4 | - package: github.com/coreos/etcd 5 | version: ^3.2.1 6 | subpackages: 7 | - clientv3 8 | - clientv3/concurrency 9 | - embed 10 | - etcdserver 11 | - package: github.com/namsral/flag 12 | version: ^1.7.4-pre 13 | - package: github.com/sirupsen/logrus 14 | version: ^1.0.0 15 | - package: github.com/topicai/candy 16 | - package: golang.org/x/crypto 17 | repo: https://github.com/golang/crypto.git 18 | vcs: git 19 | - package: golang.org/x/sys 20 | repo: https://github.com/golang/sys.git 21 | vcs: git 22 | - package: golang.org/x/text 23 | repo: https://github.com/golang/text.git 24 | vcs: git 25 | - package: github.com/satori/go.uuid 26 | version: v1.1.0 27 | - package: github.com/alecthomas/gometalinter 28 | version: v1.2.1 29 | - package: github.com/inconshreveable/log15 30 | version: v2.13 31 | - package: github.com/go-stack/stack 32 | version: v1.6.0 33 | - package: github.com/golang/protobuf 34 | -------------------------------------------------------------------------------- /paddle/fluid/operators/merge_selected_rows_op.cu.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/merge_selected_rows_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | namespace plat = paddle::platform; 19 | 20 | REGISTER_OP_CUDA_KERNEL( 21 | merge_selected_rows, 22 | ops::MergeSelectedRowsKernel, 23 | ops::MergeSelectedRowsKernel); 24 | -------------------------------------------------------------------------------- /paddle/fluid/string/split_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "paddle/fluid/string/split.h" 16 | 17 | #include 18 | 19 | #include "gtest/gtest.h" 20 | 21 | TEST(StringSplit, StringSplit) { 22 | std::string to_split = "0,1,2,3,4,5"; 23 | int i = 0; 24 | for (auto s : paddle::string::Split(to_split, ',')) { 25 | EXPECT_EQ(atoi(s.c_str()), i); 26 | i++; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /paddle/scripts/docker/root/.bashrc: -------------------------------------------------------------------------------- 1 | # Locales 2 | 3 | export LC_ALL=en_US.UTF-8 4 | export LANG=en_US.UTF-8 5 | export LANGUAGE=en_US.UTF-8 6 | 7 | # Aliases 8 | 9 | alias rm='rm -i' 10 | alias cp='cp -i' 11 | alias mv='mv -i' 12 | 13 | alias ls='ls -hFG' 14 | alias l='ls -lF' 15 | alias ll='ls -alF' 16 | alias lt='ls -ltrF' 17 | alias ll='ls -alF' 18 | alias lls='ls -alSrF' 19 | alias llt='ls -altrF' 20 | 21 | # Colorize directory listing 22 | 23 | alias ls="ls -ph --color=auto" 24 | 25 | # Colorize grep 26 | 27 | if echo hello|grep --color=auto l >/dev/null 2>&1; then 28 | export GREP_OPTIONS="--color=auto" GREP_COLOR="1;31" 29 | fi 30 | 31 | # Shell 32 | 33 | export CLICOLOR="1" 34 | 35 | YELLOW="\[\033[1;33m\]" 36 | NO_COLOUR="\[\033[0m\]" 37 | GREEN="\[\033[1;32m\]" 38 | WHITE="\[\033[1;37m\]" 39 | 40 | source ~/.scripts/git-prompt.sh 41 | 42 | export PS1="\[\033[1;33m\]λ $WHITE\h $GREEN\w$YELLOW\$(__git_ps1 \" \[\033[35m\]{\[\033[36m\]%s\[\033[35m\]}\")$NO_COLOUR " 43 | 44 | # Git 45 | 46 | source ~/.scripts/git-completion.sh 47 | -------------------------------------------------------------------------------- /python/paddle/fluid/dygraph/profiler.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | from .. import core 18 | 19 | __all__ = [ 20 | 'start_gperf_profiler', 21 | 'stop_gperf_profiler', 22 | ] 23 | 24 | 25 | def start_gperf_profiler(): 26 | core.start_imperative_gperf_profiler() 27 | 28 | 29 | def stop_gperf_profiler(): 30 | core.stop_imperative_gperf_profiler() 31 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/mkldnn/test_sum_mkldnn_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | 19 | from paddle.fluid.tests.unittests.test_sum_op import TestSumOp 20 | 21 | 22 | class TestMKLDNN(TestSumOp): 23 | def init_kernel_type(self): 24 | self.use_mkldnn = True 25 | 26 | 27 | if __name__ == '__main__': 28 | unittest.main() 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---feature-request-.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 建议(Feature request) 3 | about: 您可以提出您的建议。 You could use this template for reporting a suggestion  issue. 4 | 5 | --- 6 | 7 | 欢迎您对PaddlePaddle提出建议,非常感谢您对PaddlePaddle的贡献! 8 | 在留下您的建议时,辛苦您同步提供如下信息: 9 | - 版本、环境信息 10 | 1)PaddlePaddle版本:请提供您的PaddlePaddle版本号,例如1.1 11 | 2)CPU/GPU:您是否使用GPU进行训练,如是,请提供您的CUDA和cuDNN版本号 12 | 3)系统环境:请您描述系统类型、版本,例如Mac OS 10.14 13 | - 复现信息:如为报错,请给出复现环境、复现步骤 14 | - 建议描述:请您详细描述,您认为需优化的功能 15 | 16 | Thank you for contributing to PaddlePaddle. 17 | Before submitting the issue, you could search issue in the github in case that there was a similar issue submitted or resolved before. 18 | Please make sure that this is a feature request. 19 | **System information** 20 | -PaddlePaddle version (eg.1.1)or CommitID 21 | -CPU: including CPUMKL/OpenBlas/MKLDNN version 22 | -GPU: including CUDA/CUDNN version 23 | -OS Platform (eg.Mac OS 10.14) 24 | **To Reproduce** 25 | Steps to reproduce the behavior 26 | **Describe the feature and the current behavior/state.** 27 | **Any Other info.** 28 | -------------------------------------------------------------------------------- /cmake/make_resource.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import re 17 | import sys 18 | 19 | res = sys.argv[1] 20 | out = sys.argv[2] 21 | var = re.sub(r'[ .-]', '_', os.path.basename(res)) 22 | 23 | open(out, "w").write("const unsigned char " + var + "[] = {" + ",".join([ 24 | "0x%02x" % ord(c) for c in open(res).read() 25 | ]) + ",0};\n" + "const unsigned " + var + "_size = sizeof(" + var + ");\n") 26 | -------------------------------------------------------------------------------- /paddle/fluid/operators/math/sample_prob.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/math/sample_prob.h" 16 | 17 | namespace paddle { 18 | namespace operators { 19 | namespace math { 20 | 21 | template class SampleWithProb; 22 | template class SampleWithProb; 23 | 24 | } // namespace math 25 | } // namespace operators 26 | } // namespace paddle 27 | -------------------------------------------------------------------------------- /paddle/fluid/operators/smooth_l1_loss_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/smooth_l1_loss_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | smooth_l1_loss, 19 | ops::SmoothL1LossKernel); 20 | REGISTER_OP_CUDA_KERNEL( 21 | smooth_l1_loss_grad, 22 | ops::SmoothL1LossGradKernel); 23 | -------------------------------------------------------------------------------- /paddle/fluid/operators/squared_l2_norm_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/squared_l2_norm_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | squared_l2_norm, 19 | ops::SquaredL2NormKernel); 20 | REGISTER_OP_CUDA_KERNEL( 21 | squared_l2_norm_grad, 22 | ops::SquaredL2NormGradKernel); 23 | -------------------------------------------------------------------------------- /paddle/fluid/operators/cumsum_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/cum_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | using CUDA = paddle::platform::CUDADeviceContext; 19 | 20 | REGISTER_OP_CUDA_KERNEL(cumsum, ops::CumKernel>, 21 | ops::CumKernel>, 22 | ops::CumKernel>); 23 | -------------------------------------------------------------------------------- /paddle/fluid/operators/random_crop_op.cu: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "paddle/fluid/operators/random_crop_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | template 19 | using Kernel = ops::RandomCropKernel; 20 | REGISTER_OP_CUDA_KERNEL(random_crop, Kernel, Kernel, Kernel, 21 | Kernel, Kernel); 22 | -------------------------------------------------------------------------------- /paddle/fluid/operators/im2sequence_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/im2sequence_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | 18 | REGISTER_OP_CUDA_KERNEL( 19 | im2sequence, 20 | ops::Im2SequenceKernel); 21 | REGISTER_OP_CUDA_KERNEL( 22 | im2sequence_grad, 23 | ops::Im2SequenceGradKernel); 24 | -------------------------------------------------------------------------------- /paddle/fluid/operators/math/context_project.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/math/context_project.h" 15 | 16 | namespace paddle { 17 | namespace operators { 18 | namespace math { 19 | 20 | template class ContextProjectFunctor; 21 | template class ContextProjectFunctor; 22 | 23 | } // namespace math 24 | } // namespace operators 25 | } // namespace paddle 26 | -------------------------------------------------------------------------------- /paddle/fluid/framework/ir/sync_batch_norm_pass.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | #include 18 | #include "paddle/fluid/framework/ir/pass.h" 19 | 20 | namespace paddle { 21 | namespace framework { 22 | namespace ir { 23 | 24 | class SyncBatchNormPass : public Pass { 25 | protected: 26 | void ApplyImpl(ir::Graph* graph) const override; 27 | }; 28 | 29 | } // namespace ir 30 | } // namespace framework 31 | } // namespace paddle 32 | -------------------------------------------------------------------------------- /paddle/fluid/operators/margin_rank_loss_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/margin_rank_loss_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | 19 | REGISTER_OP_CUDA_KERNEL( 20 | margin_rank_loss, 21 | ops::MarginRankLossKernel); 22 | REGISTER_OP_CUDA_KERNEL( 23 | margin_rank_loss_grad, 24 | ops::MarginRankLossGradKernel); 25 | -------------------------------------------------------------------------------- /paddle/fluid/operators/math/context_project.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/math/context_project.h" 16 | 17 | namespace paddle { 18 | namespace operators { 19 | namespace math { 20 | 21 | template class ContextProjectFunctor; 22 | template class ContextProjectFunctor; 23 | 24 | } // namespace math 25 | } // namespace operators 26 | } // namespace paddle 27 | -------------------------------------------------------------------------------- /paddle/fluid/operators/save_combine_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/save_combine_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | 19 | REGISTER_OP_CUDA_KERNEL( 20 | save_combine, 21 | ops::SaveCombineOpKernel, 22 | ops::SaveCombineOpKernel, 23 | ops::SaveCombineOpKernel); 24 | -------------------------------------------------------------------------------- /paddle/fluid/operators/sequence_ops/sequence_pool_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/sequence_ops/sequence_pool_op.h" 15 | 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | sequence_pool, 19 | ops::SequencePoolKernel); 20 | REGISTER_OP_CUDA_KERNEL( 21 | sequence_pool_grad, 22 | ops::SequencePoolGradKernel); 23 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/ngraph/test_cross_entropy_ngraph_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | from paddle.fluid.tests.unittests.test_cross_entropy_op import TestCrossEntropyOp, TestCrossEntropyOp2, TestCrossEntropyOp3, TestCrossEntropyOp4, TestCrossEntropyOp5, TestCrossEntropyOp6, TestCrossEntropyOp7 19 | 20 | if __name__ == "__main__": 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /cmake/external/threadpool.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(ExternalProject) 2 | 3 | SET(THREADPOOL_SOURCE_DIR ${THIRD_PARTY_PATH}/threadpool) 4 | SET(THREADPOOL_INCLUDE_DIR ${THREADPOOL_SOURCE_DIR}/src/extern_threadpool) 5 | INCLUDE_DIRECTORIES(${THREADPOOL_INCLUDE_DIR}) 6 | 7 | ExternalProject_Add( 8 | extern_threadpool 9 | ${EXTERNAL_PROJECT_LOG_ARGS} 10 | GIT_REPOSITORY "https://github.com/progschj/ThreadPool.git" 11 | GIT_TAG 9a42ec1329f259a5f4881a291db1dcb8f2ad9040 12 | PREFIX ${THREADPOOL_SOURCE_DIR} 13 | UPDATE_COMMAND "" 14 | CONFIGURE_COMMAND "" 15 | BUILD_COMMAND "" 16 | INSTALL_COMMAND "" 17 | TEST_COMMAND "" 18 | ) 19 | 20 | if (${CMAKE_VERSION} VERSION_LESS "3.3.0") 21 | set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/threadpool_dummy.c) 22 | file(WRITE ${dummyfile} "const char *dummy_threadpool = \"${dummyfile}\";") 23 | add_library(simple_threadpool STATIC ${dummyfile}) 24 | else() 25 | add_library(simple_threadpool INTERFACE) 26 | endif() 27 | 28 | add_dependencies(simple_threadpool extern_threadpool) 29 | -------------------------------------------------------------------------------- /paddle/fluid/operators/elementwise/elementwise_mod_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/elementwise/elementwise_mod_op.h" 15 | #include "paddle/fluid/platform/float16.h" 16 | 17 | namespace ops = paddle::operators; 18 | namespace plat = paddle::platform; 19 | 20 | REGISTER_OP_CUDA_KERNEL( 21 | elementwise_mod, ops::ElementwiseModKernel, 22 | ops::ElementwiseModKernel); 23 | -------------------------------------------------------------------------------- /paddle/fluid/platform/dynload/nccl.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/platform/dynload/nccl.h" 16 | 17 | namespace paddle { 18 | namespace platform { 19 | namespace dynload { 20 | 21 | std::once_flag nccl_dso_flag; 22 | void *nccl_dso_handle; 23 | 24 | #define DEFINE_WRAP(__name) DynLoad__##__name __name 25 | 26 | NCCL_RAND_ROUTINE_EACH(DEFINE_WRAP); 27 | 28 | } // namespace dynload 29 | } // namespace platform 30 | } // namespace paddle 31 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/test_eager_deletion_transformer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import unittest 17 | import paddle.fluid as fluid 18 | 19 | fluid.core._set_eager_deletion_mode(0.0, 1.0, True) 20 | 21 | os.environ['RECORDIO_FILENAME'] = './eager_deletion_transformer.wmt16.recordio' 22 | 23 | from test_parallel_executor_transformer import TestTransformer 24 | 25 | if __name__ == '__main__': 26 | unittest.main() 27 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import unittest 17 | import paddle.fluid as fluid 18 | 19 | os.environ['RECORDIO_FILENAME'] = './p_gc_transformer.wmt16.recordio' 20 | 21 | fluid.core._set_eager_deletion_mode(0.0, 0.55, True) 22 | 23 | from test_parallel_executor_transformer import TestTransformer 24 | 25 | if __name__ == '__main__': 26 | unittest.main() 27 | -------------------------------------------------------------------------------- /paddle/fluid/framework/feed_fetch_type.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | #include 17 | #include "paddle/fluid/framework/lod_tensor.h" 18 | 19 | namespace paddle { 20 | namespace framework { 21 | using FeedFetchType = LoDTensor; 22 | using FeedFetchList = std::vector; 23 | 24 | static const char kFeedOpType[] = "feed"; 25 | static const char kFetchOpType[] = "fetch"; 26 | 27 | } // namespace framework 28 | } // namespace paddle 29 | -------------------------------------------------------------------------------- /paddle/fluid/framework/ir/runtime_context_cache_pass.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | #include 18 | #include "paddle/fluid/framework/ir/pass.h" 19 | 20 | namespace paddle { 21 | namespace framework { 22 | namespace ir { 23 | 24 | class RuntimeContextCachePass : public Pass { 25 | protected: 26 | void ApplyImpl(ir::Graph* graph) const override; 27 | }; 28 | 29 | } // namespace ir 30 | } // namespace framework 31 | } // namespace paddle 32 | -------------------------------------------------------------------------------- /paddle/fluid/operators/sequence_ops/sequence_slice_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/sequence_ops/sequence_slice_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL( 19 | sequence_slice, 20 | ops::SequenceSliceOpKernel); 21 | REGISTER_OP_CUDA_KERNEL( 22 | sequence_slice_grad, 23 | ops::SequenceSliceGradOpKernel); 24 | -------------------------------------------------------------------------------- /paddle/fluid/operators/split_op.cu.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/split_op.h" 16 | namespace ops = paddle::operators; 17 | REGISTER_OP_CUDA_KERNEL( 18 | split, ops::SplitOpKernel, 19 | ops::SplitOpKernel, 20 | ops::SplitOpKernel, 21 | ops::SplitOpKernel); 22 | -------------------------------------------------------------------------------- /paddle/fluid/platform/dynload/curand.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/platform/dynload/curand.h" 16 | 17 | namespace paddle { 18 | namespace platform { 19 | namespace dynload { 20 | 21 | std::once_flag curand_dso_flag; 22 | void *curand_dso_handle; 23 | 24 | #define DEFINE_WRAP(__name) DynLoad__##__name __name 25 | 26 | CURAND_RAND_ROUTINE_EACH(DEFINE_WRAP); 27 | 28 | } // namespace dynload 29 | } // namespace platform 30 | } // namespace paddle 31 | -------------------------------------------------------------------------------- /paddle/fluid/platform/dynload/mklml.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/platform/dynload/mklml.h" 16 | 17 | namespace paddle { 18 | namespace platform { 19 | namespace dynload { 20 | 21 | std::once_flag mklml_dso_flag; 22 | void* mklml_dso_handle = nullptr; 23 | 24 | #define DEFINE_WRAP(__name) DynLoad__##__name __name 25 | 26 | MKLML_ROUTINE_EACH(DEFINE_WRAP); 27 | 28 | } // namespace dynload 29 | } // namespace platform 30 | } // namespace paddle 31 | -------------------------------------------------------------------------------- /paddle/fluid/framework/data_feed_factory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #pragma once 16 | 17 | #include 18 | #include 19 | #include "paddle/fluid/framework/data_feed.h" 20 | 21 | namespace paddle { 22 | namespace framework { 23 | class DataFeedFactory { 24 | public: 25 | static std::string DataFeedTypeList(); 26 | static std::shared_ptr CreateDataFeed(std::string data_feed_class); 27 | }; 28 | } // namespace framework 29 | } // namespace paddle 30 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/mkldnn/test_gaussian_random_mkldnn_op.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | 19 | from paddle.fluid.tests.unittests.test_gaussian_random_op import TestGaussianRandomOp 20 | 21 | 22 | class TestMKLDNN(TestGaussianRandomOp): 23 | def init_kernel_type(self): 24 | self.use_mkldnn = True 25 | 26 | 27 | if __name__ == '__main__': 28 | unittest.main() 29 | -------------------------------------------------------------------------------- /python/paddle/fluid/tests/unittests/test_op_support_gpu.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import print_function 16 | 17 | import unittest 18 | import paddle.fluid.core as core 19 | 20 | 21 | class TestOpSupportGPU(unittest.TestCase): 22 | def test_case(self): 23 | self.assertEqual(core.is_compiled_with_cuda(), 24 | core.op_support_gpu("sum")) 25 | 26 | 27 | if __name__ == '__main__': 28 | unittest.main() 29 | -------------------------------------------------------------------------------- /tools/manylinux1/build_scripts/install_nccl2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VERSION=$(nvcc --version | grep release | grep -oEi "release ([0-9]+)\.([0-9])"| sed "s/release //") 3 | if [ "$VERSION" == "9.0" ]; then 4 | DEB="nccl-repo-ubuntu1604-2.1.15-ga-cuda9.0_1-1_amd64.deb" 5 | URL="http://nccl2-deb.gz.bcebos.com/nccl-repo-ubuntu1604-2.1.15-ga-cuda9.0_1-1_amd64.deb" 6 | else 7 | DEB="nccl-repo-ubuntu1604-2.1.15-ga-cuda8.0_1-1_amd64.deb" 8 | URL="http://nccl2-deb.gz.bcebos.com/nccl-repo-ubuntu1604-2.1.15-ga-cuda8.0_1-1_amd64.deb" 9 | fi 10 | 11 | DIR="/nccl2" 12 | mkdir -p $DIR 13 | # we cached the nccl2 deb package in BOS, so we can download it with wget 14 | # install nccl2: http://docs.nvidia.com/deeplearning/sdk/nccl-install-guide/index.html#down 15 | wget -O $DIR/$DEB $URL 16 | 17 | cd $DIR && ar x $DEB && tar xf data.tar.xz 18 | DEBS=$(find ./var/ -name "*.deb") 19 | for sub_deb in $DEBS; do 20 | echo $sub_deb 21 | ar x $sub_deb && tar xf data.tar.xz 22 | done 23 | mv -f usr/include/nccl.h /usr/local/include/ 24 | mv -f usr/lib/x86_64-linux-gnu/libnccl* /usr/local/lib/ 25 | rm -rf $DIR 26 | -------------------------------------------------------------------------------- /paddle/fluid/platform/dynload/warpctc.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/platform/dynload/warpctc.h" 16 | 17 | namespace paddle { 18 | namespace platform { 19 | namespace dynload { 20 | 21 | std::once_flag warpctc_dso_flag; 22 | void* warpctc_dso_handle = nullptr; 23 | 24 | #define DEFINE_WRAP(__name) DynLoad__##__name __name 25 | 26 | WARPCTC_ROUTINE_EACH(DEFINE_WRAP); 27 | 28 | } // namespace dynload 29 | } // namespace platform 30 | } // namespace paddle 31 | -------------------------------------------------------------------------------- /paddle/fluid/train/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | function(train_test TARGET_NAME) 2 | set(options "") 3 | set(oneValueArgs "") 4 | set(multiValueArgs ARGS) 5 | cmake_parse_arguments(train_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) 6 | 7 | set(arg_list "") 8 | if(train_test_ARGS) 9 | foreach(arg ${train_test_ARGS}) 10 | list(APPEND arg_list "_${arg}") 11 | endforeach() 12 | else() 13 | list(APPEND arg_list "_") 14 | endif() 15 | foreach(arg ${arg_list}) 16 | string(REGEX REPLACE "^_$" "" arg "${arg}") 17 | cc_test(test_train_${TARGET_NAME}${arg} 18 | SRCS test_train_${TARGET_NAME}.cc 19 | DEPS paddle_fluid_origin 20 | ARGS --dirname=${PYTHON_TESTS_DIR}/book/${TARGET_NAME}${arg}.train.model/) 21 | set_tests_properties(test_train_${TARGET_NAME}${arg} 22 | PROPERTIES DEPENDS test_${TARGET_NAME}) 23 | endforeach() 24 | endfunction(train_test) 25 | 26 | 27 | if(WITH_TESTING) 28 | train_test(recognize_digits ARGS mlp conv) 29 | endif() 30 | -------------------------------------------------------------------------------- /paddle/fluid/operators/rank_loss_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/rank_loss_op.h" 16 | 17 | REGISTER_OP_CUDA_KERNEL(rank_loss, 18 | paddle::operators::RankLossKernel< 19 | paddle::platform::CUDADeviceContext, float>); 20 | REGISTER_OP_CUDA_KERNEL(rank_loss_grad, 21 | paddle::operators::RankLossGradKernel< 22 | paddle::platform::CUDADeviceContext, float>); 23 | -------------------------------------------------------------------------------- /paddle/fluid/framework/ir/attention_lstm_fuse_pass.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #include "paddle/fluid/framework/ir/fuse_pass_base.h" 18 | 19 | namespace paddle { 20 | namespace framework { 21 | namespace ir { 22 | 23 | class AttentionLSTMFusePass : public FusePassBase { 24 | protected: 25 | void ApplyImpl(ir::Graph* graph) const override; 26 | }; 27 | 28 | } // namespace ir 29 | } // namespace framework 30 | } // namespace paddle 31 | -------------------------------------------------------------------------------- /paddle/fluid/operators/elementwise/elementwise_floordiv_op.cu: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | #include "paddle/fluid/operators/elementwise/elementwise_floordiv_op.h" 15 | #include "paddle/fluid/platform/float16.h" 16 | 17 | namespace ops = paddle::operators; 18 | namespace plat = paddle::platform; 19 | 20 | REGISTER_OP_CUDA_KERNEL( 21 | elementwise_floordiv, 22 | ops::ElementwiseFloorDivKernel, 23 | ops::ElementwiseFloorDivKernel); 24 | -------------------------------------------------------------------------------- /paddle/fluid/platform/dynload/tensorrt.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/platform/dynload/tensorrt.h" 16 | 17 | namespace paddle { 18 | namespace platform { 19 | namespace dynload { 20 | 21 | std::once_flag tensorrt_dso_flag; 22 | void *tensorrt_dso_handle; 23 | 24 | #define DEFINE_WRAP(__name) DynLoad__##__name __name 25 | 26 | TENSORRT_RAND_ROUTINE_EACH(DEFINE_WRAP); 27 | 28 | } // namespace dynload 29 | } // namespace platform 30 | } // namespace paddle 31 | -------------------------------------------------------------------------------- /paddle/fluid/operators/fill_constant_op.cu.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. */ 14 | 15 | #include "paddle/fluid/operators/fill_constant_op.h" 16 | 17 | namespace ops = paddle::operators; 18 | REGISTER_OP_CUDA_KERNEL(fill_constant, ops::FillConstantKernel, 19 | ops::FillConstantKernel, 20 | ops::FillConstantKernel, 21 | ops::FillConstantKernel, 22 | ops::FillConstantKernel); 23 | --------------------------------------------------------------------------------