add support to gcc8, add docker env test=develop (#19807)
* add support to gcc8, add docker env test=developrevert-20712-fix_depthwise_conv
parent
5223b0dd9d
commit
9e5948230e
@ -0,0 +1,221 @@
|
||||
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
* notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of M.I.T. not be used in
|
||||
* advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
* M.I.T. makes no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_NAMESER_H
|
||||
# include <arpa/nameser.h>
|
||||
#else
|
||||
# include "nameser.h"
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
|
||||
# include <arpa/nameser_compat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "ares.h"
|
||||
#include "ares_dns.h"
|
||||
#include "ares_nowarn.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
||||
int addrlen, int family, struct hostent **host)
|
||||
{
|
||||
unsigned int qdcount, ancount;
|
||||
int status, i, rr_type, rr_class, rr_len;
|
||||
long len;
|
||||
const unsigned char *aptr;
|
||||
char *ptrname, *hostname, *rr_name, *rr_data;
|
||||
struct hostent *hostent;
|
||||
int aliascnt = 0;
|
||||
int alias_alloc = 8;
|
||||
char ** aliases;
|
||||
size_t rr_data_len;
|
||||
|
||||
/* Set *host to NULL for all failure cases. */
|
||||
*host = NULL;
|
||||
|
||||
/* Give up if abuf doesn't have room for a header. */
|
||||
if (alen < HFIXEDSZ)
|
||||
return ARES_EBADRESP;
|
||||
|
||||
/* Fetch the question and answer count from the header. */
|
||||
qdcount = DNS_HEADER_QDCOUNT(abuf);
|
||||
ancount = DNS_HEADER_ANCOUNT(abuf);
|
||||
if (qdcount != 1)
|
||||
return ARES_EBADRESP;
|
||||
|
||||
/* Expand the name from the question, and skip past the question. */
|
||||
aptr = abuf + HFIXEDSZ;
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len);
|
||||
if (status != ARES_SUCCESS)
|
||||
return status;
|
||||
if (aptr + len + QFIXEDSZ > abuf + alen)
|
||||
{
|
||||
ares_free(ptrname);
|
||||
return ARES_EBADRESP;
|
||||
}
|
||||
aptr += len + QFIXEDSZ;
|
||||
|
||||
/* Examine each answer resource record (RR) in turn. */
|
||||
hostname = NULL;
|
||||
aliases = ares_malloc(alias_alloc * sizeof(char *));
|
||||
if (!aliases)
|
||||
{
|
||||
ares_free(ptrname);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
for (i = 0; i < (int)ancount; i++)
|
||||
{
|
||||
/* Decode the RR up to the data field. */
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
|
||||
if (status != ARES_SUCCESS)
|
||||
break;
|
||||
aptr += len;
|
||||
if (aptr + RRFIXEDSZ > abuf + alen)
|
||||
{
|
||||
ares_free(rr_name);
|
||||
status = ARES_EBADRESP;
|
||||
break;
|
||||
}
|
||||
rr_type = DNS_RR_TYPE(aptr);
|
||||
rr_class = DNS_RR_CLASS(aptr);
|
||||
rr_len = DNS_RR_LEN(aptr);
|
||||
aptr += RRFIXEDSZ;
|
||||
if (aptr + rr_len > abuf + alen)
|
||||
{
|
||||
ares_free(rr_name);
|
||||
status = ARES_EBADRESP;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rr_class == C_IN && rr_type == T_PTR
|
||||
&& strcasecmp(rr_name, ptrname) == 0)
|
||||
{
|
||||
/* Decode the RR data and set hostname to it. */
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
|
||||
&len);
|
||||
if (status != ARES_SUCCESS)
|
||||
{
|
||||
ares_free(rr_name);
|
||||
break;
|
||||
}
|
||||
if (hostname)
|
||||
ares_free(hostname);
|
||||
hostname = rr_data;
|
||||
rr_data_len = strlen(rr_data)+1;
|
||||
aliases[aliascnt] = ares_malloc(rr_data_len * sizeof(char));
|
||||
if (!aliases[aliascnt])
|
||||
{
|
||||
ares_free(rr_name);
|
||||
status = ARES_ENOMEM;
|
||||
break;
|
||||
}
|
||||
strncpy(aliases[aliascnt], rr_data, rr_data_len);
|
||||
aliascnt++;
|
||||
if (aliascnt >= alias_alloc) {
|
||||
char **ptr;
|
||||
alias_alloc *= 2;
|
||||
ptr = ares_realloc(aliases, alias_alloc * sizeof(char *));
|
||||
if(!ptr) {
|
||||
ares_free(rr_name);
|
||||
status = ARES_ENOMEM;
|
||||
break;
|
||||
}
|
||||
aliases = ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (rr_class == C_IN && rr_type == T_CNAME)
|
||||
{
|
||||
/* Decode the RR data and replace ptrname with it. */
|
||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
|
||||
&len);
|
||||
if (status != ARES_SUCCESS)
|
||||
{
|
||||
ares_free(rr_name);
|
||||
break;
|
||||
}
|
||||
ares_free(ptrname);
|
||||
ptrname = rr_data;
|
||||
}
|
||||
|
||||
ares_free(rr_name);
|
||||
aptr += rr_len;
|
||||
if (aptr > abuf + alen)
|
||||
{ /* LCOV_EXCL_START: already checked above */
|
||||
status = ARES_EBADRESP;
|
||||
break;
|
||||
} /* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (status == ARES_SUCCESS && !hostname)
|
||||
status = ARES_ENODATA;
|
||||
if (status == ARES_SUCCESS)
|
||||
{
|
||||
/* We got our answer. Allocate memory to build the host entry. */
|
||||
hostent = ares_malloc(sizeof(struct hostent));
|
||||
if (hostent)
|
||||
{
|
||||
hostent->h_addr_list = ares_malloc(2 * sizeof(char *));
|
||||
if (hostent->h_addr_list)
|
||||
{
|
||||
hostent->h_addr_list[0] = ares_malloc(addrlen);
|
||||
if (hostent->h_addr_list[0])
|
||||
{
|
||||
hostent->h_aliases = ares_malloc((aliascnt+1) * sizeof (char *));
|
||||
if (hostent->h_aliases)
|
||||
{
|
||||
/* Fill in the hostent and return successfully. */
|
||||
hostent->h_name = hostname;
|
||||
for (i=0 ; i<aliascnt ; i++)
|
||||
hostent->h_aliases[i] = aliases[i];
|
||||
hostent->h_aliases[aliascnt] = NULL;
|
||||
hostent->h_addrtype = aresx_sitoss(family);
|
||||
hostent->h_length = aresx_sitoss(addrlen);
|
||||
memcpy(hostent->h_addr_list[0], addr, addrlen);
|
||||
hostent->h_addr_list[1] = NULL;
|
||||
*host = hostent;
|
||||
ares_free(aliases);
|
||||
ares_free(ptrname);
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
ares_free(hostent->h_addr_list[0]);
|
||||
}
|
||||
ares_free(hostent->h_addr_list);
|
||||
}
|
||||
ares_free(hostent);
|
||||
}
|
||||
status = ARES_ENOMEM;
|
||||
}
|
||||
for (i=0 ; i<aliascnt ; i++)
|
||||
if (aliases[i])
|
||||
ares_free(aliases[i]);
|
||||
ares_free(aliases);
|
||||
if (hostname)
|
||||
ares_free(hostname);
|
||||
ares_free(ptrname);
|
||||
return status;
|
||||
}
|
@ -0,0 +1,178 @@
|
||||
# A image for building paddle binaries and install
|
||||
# Use cuda devel base image for both cpu and gpu environment
|
||||
# When you modify it, please be aware of cudnn-runtime version
|
||||
# and libcudnn.so.x in paddle/scripts/docker/build.sh
|
||||
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
|
||||
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
|
||||
|
||||
# ENV variables
|
||||
ARG WITH_GPU
|
||||
ARG WITH_AVX
|
||||
ARG WITH_DOC
|
||||
|
||||
ENV WITH_GPU=${WITH_GPU:-ON}
|
||||
ENV WITH_AVX=${WITH_AVX:-ON}
|
||||
ENV WITH_DOC=${WITH_DOC:-OFF}
|
||||
|
||||
ENV HOME /root
|
||||
# Add bash enhancements
|
||||
COPY ./paddle/scripts/docker/root/ /root/
|
||||
|
||||
# Prepare packages for Python
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
|
||||
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
|
||||
xz-utils tk-dev libffi-dev liblzma-dev
|
||||
RUN apt-get install -y python-dev python-pip wget vim git
|
||||
|
||||
# install cmake
|
||||
WORKDIR /home
|
||||
RUN wget https://cmake.org/files/v3.4/cmake-3.4.0-Linux-x86_64.tar.gz
|
||||
RUN tar -xvf cmake-3.4.0-Linux-x86_64.tar.gz
|
||||
RUN apt install libidn11
|
||||
ENV PATH=/home/cmake-3.4.0-Linux-x86_64/bin:$PATH
|
||||
WORKDIR /usr/bin
|
||||
RUN apt install -y gcc-8 g++-8
|
||||
RUN cp gcc gcc.bak
|
||||
RUN cp g++ g++.bak
|
||||
RUN rm gcc
|
||||
RUN rm g++
|
||||
RUN ln -s gcc-8 gcc
|
||||
RUN ln -s g++-8 g++
|
||||
|
||||
# Install Python3.6
|
||||
RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \
|
||||
tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \
|
||||
./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \
|
||||
wget -q https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz && \
|
||||
tar -xzf Python-3.6.9.tgz && cd Python-3.6.9 && \
|
||||
CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \
|
||||
make -j8 > /dev/null && make altinstall > /dev/null
|
||||
|
||||
# Install Python3.7
|
||||
RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \
|
||||
tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \
|
||||
CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \
|
||||
make -j8 > /dev/null && make altinstall > /dev/null
|
||||
|
||||
RUN rm -r /root/python_build
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --allow-downgrades --allow-change-held-packages \
|
||||
patchelf python3 python3-dev python3-pip \
|
||||
git python-pip python-dev python-opencv openssh-server bison \
|
||||
wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \
|
||||
curl sed grep graphviz libjpeg-dev zlib1g-dev \
|
||||
python-matplotlib \
|
||||
automake locales clang-format swig cmake \
|
||||
liblapack-dev liblapacke-dev \
|
||||
net-tools libtool ccache module-init-tools && \
|
||||
apt-get clean -y
|
||||
|
||||
# Install Python2.7.15 to replace original python
|
||||
WORKDIR /home
|
||||
ENV version=2.7.15
|
||||
RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz
|
||||
RUN tar -xvf Python-$version.tgz
|
||||
WORKDIR /home/Python-$version
|
||||
RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15
|
||||
RUN make && make install
|
||||
|
||||
RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc
|
||||
RUN echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc
|
||||
RUN echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc
|
||||
RUN echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc
|
||||
ENV PATH=/usr/local/python2.7.15/include:${PATH}
|
||||
ENV PATH=/usr/local/python2.7.15/bin:${PATH}
|
||||
ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}
|
||||
ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH
|
||||
RUN mv /usr/bin/python /usr/bin/python.bak
|
||||
RUN ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python
|
||||
RUN ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python
|
||||
WORKDIR /home
|
||||
RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip
|
||||
RUN apt-get -y install unzip
|
||||
RUN unzip setuptools-40.6.2.zip
|
||||
WORKDIR /home/setuptools-40.6.2
|
||||
RUN python setup.py build
|
||||
RUN python setup.py install
|
||||
WORKDIR /home
|
||||
RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz
|
||||
RUN tar -zxvf pip-18.0.tar.gz
|
||||
WORKDIR pip-18.0
|
||||
RUN python setup.py install
|
||||
|
||||
WORKDIR /home
|
||||
RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \
|
||||
rm -r Python-$version setuptools-40.6.2 pip-18.0
|
||||
|
||||
# git credential to skip password typing
|
||||
RUN git config --global credential.helper store
|
||||
|
||||
# Fix locales to en_US.UTF-8
|
||||
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
|
||||
|
||||
# specify sphinx version as 1.5.6 and remove -U option for [pip install -U
|
||||
# sphinx-rtd-theme] since -U option will cause sphinx being updated to newest
|
||||
# version(1.7.1 for now), which causes building documentation failed.
|
||||
RUN pip3 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
|
||||
pip3 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
|
||||
pip3 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
|
||||
pip3.6 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
|
||||
pip3.6 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
|
||||
pip3.6 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
|
||||
pip3.7 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
|
||||
pip3.7 --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
|
||||
pip3.7 --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark && \
|
||||
pip --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
|
||||
pip --no-cache-dir install -U docopt PyYAML sphinx==1.5.6 && \
|
||||
pip --no-cache-dir install sphinx-rtd-theme==0.1.9 recommonmark
|
||||
|
||||
RUN pip3 --no-cache-dir install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
|
||||
pip3 --no-cache-dir install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
|
||||
pip3 --no-cache-dir install opencv-python && \
|
||||
pip3.6 --no-cache-dir install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
|
||||
pip3.6 --no-cache-dir install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
|
||||
pip3.6 --no-cache-dir install opencv-python && \
|
||||
pip3.7 --no-cache-dir install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
|
||||
pip3.7 --no-cache-dir install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
|
||||
pip3.7 --no-cache-dir install opencv-python && \
|
||||
pip --no-cache-dir install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
|
||||
pip --no-cache-dir install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
|
||||
pip --no-cache-dir install opencv-python
|
||||
|
||||
#For docstring checker
|
||||
RUN pip3 --no-cache-dir install pylint pytest astroid isort
|
||||
RUN pip3.6 --no-cache-dir install pylint pytest astroid isort
|
||||
RUN pip3.7 --no-cache-dir install pylint pytest astroid isort
|
||||
RUN pip --no-cache-dir install pylint pytest astroid isort LinkChecker
|
||||
|
||||
RUN pip3 --no-cache-dir install coverage
|
||||
RUN pip3.6 --no-cache-dir install coverage
|
||||
RUN pip3.7 --no-cache-dir install coverage
|
||||
RUN pip --no-cache-dir install coverage
|
||||
|
||||
COPY ./python/requirements.txt /root/
|
||||
RUN pip3 --no-cache-dir install -r /root/requirements.txt
|
||||
RUN pip3.6 --no-cache-dir install -r /root/requirements.txt
|
||||
RUN pip3.7 --no-cache-dir install -r /root/requirements.txt
|
||||
RUN pip --no-cache-dir install -r /root/requirements.txt
|
||||
|
||||
# To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use
|
||||
# the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
|
||||
RUN apt-get install -y libssl-dev libffi-dev && apt-get clean -y
|
||||
RUN pip3 --no-cache-dir install certifi urllib3[secure]
|
||||
RUN pip3.6 --no-cache-dir install certifi urllib3[secure]
|
||||
RUN pip3.7 --no-cache-dir install certifi urllib3[secure]
|
||||
RUN pip --no-cache-dir install certifi urllib3[secure]
|
||||
|
||||
RUN echo "export PATH=/usr/lib/ccache:${PATH}" >> ~/.bashrc
|
||||
|
||||
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
|
||||
RUN mkdir /var/run/sshd
|
||||
RUN echo 'root:root' | chpasswd
|
||||
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
|
||||
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
|
||||
CMD source ~/.bashrc
|
||||
EXPOSE 22
|
||||
|
Loading…
Reference in new issue