Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try opencl #6133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 35 additions & 21 deletions .github/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
set -ex

# Add support for https apt sources.
wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt-transport-https_1.2.32ubuntu0.2_amd64.deb
echo "93475e4cc5e7a86de63fea0316f3f2cd8b791cf4d6ea50a6d63f5bd8e1da5726 apt-transport-https_1.2.32ubuntu0.2_amd64.deb" | sha256sum -c
sudo dpkg -i apt-transport-https_1.2.32ubuntu0.2_amd64.deb
rm apt-transport-https_1.2.32ubuntu0.2_amd64.deb
# wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt-transport-https_1.2.32ubuntu0.2_amd64.deb
# echo "93475e4cc5e7a86de63fea0316f3f2cd8b791cf4d6ea50a6d63f5bd8e1da5726 apt-transport-https_1.2.32ubuntu0.2_amd64.deb" | sha256sum -c
# sudo dpkg -i apt-transport-https_1.2.32ubuntu0.2_amd64.deb
# rm apt-transport-https_1.2.32ubuntu0.2_amd64.deb

export MAX_JOBS=8
if [ "${CIRCLE_JOB}" != "COVERAGE" ]; then
Expand All @@ -27,8 +27,7 @@ if [ "${CIRCLE_JOB}" != "COVERAGE" ]; then
fi

install_pocl() {
sudo apt-get install -y ocl-icd-opencl-dev clinfo libhwloc-dev opencl-headers

# sudo yum install -y ocl-icd-opencl-dev clinfo libhwloc-dev opencl-headers
git clone https://github.com/pocl/pocl.git
cd pocl && git checkout 4efafa82c087b5e846a9f8083d46b3cdac2f698b && cd ../
mkdir build_pocl
Expand Down Expand Up @@ -57,12 +56,12 @@ install_fmt() {

upgrade_python() {
echo "Removing old python...";
sudo apt-get remove --purge -y python3.6 python3-pip libpython3-dev
sudo apt-get autoremove -y
# sudo yum remove --purge -y python3.6 python3-pip libpython3-dev
# sudo yum autoremove -y

echo "Installing dependencies for new python..."
sudo apt-get update
sudo apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev
# sudo yum update
# sudo yum install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev

echo "Installing new python..."
mkdir python-src
Expand All @@ -85,30 +84,43 @@ upgrade_python() {
sudo pip3.9 install virtualenv
}

GLOW_DEPS="libpng-dev libgoogle-glog-dev libboost-all-dev libdouble-conversion-dev libgflags-dev libjemalloc-dev libpthread-stubs0-dev libevent-dev libssl-dev"
GLOW_DEPS=" \
libpng-devel \
glog-devel \
boost-devel \
double-conversion-devel \
gflags-devel \
jemalloc-devel \
libevent-devel \
clang-devel \
protobuf-compiler \
protobuf-devel \
llvm \
llvm-devel \
openssl-devel"

if [ "${CIRCLE_JOB}" == "CHECK_CLANG_AND_PEP8_FORMAT" ]; then
sudo apt-get update
#sudo yum update
upgrade_python
else
# Install Glow dependencies
sudo apt-get update
#sudo yum update

# Redirect clang
sudo ln -s /usr/bin/clang-8 /usr/bin/clang
sudo ln -s /usr/bin/clang++-8 /usr/bin/clang++
sudo ln -s /usr/bin/llvm-symbolizer-8 /usr/bin/llvm-symbolizer
sudo ln -s /usr/bin/llvm-config-8 /usr/bin/llvm-config-8.0

sudo apt-get install -y ${GLOW_DEPS}
sudo yum install -y ${GLOW_DEPS}
install_fmt
fi

# Since we are using llvm-7 in these two branches, we cannot use pip install cmake
if [ "${CIRCLE_JOB}" != "PYTORCH" ] && [ "${CIRCLE_JOB}" != "CHECK_CLANG_AND_PEP8_FORMAT" ]; then
sudo pip install cmake==3.17.3
else
sudo apt-get install cmake
sudo yum install -y cmake
fi

# Install ninja, (newest version of) autopep8 through pip
Expand All @@ -131,8 +143,8 @@ if [[ "${CIRCLE_JOB}" == "ASAN" ]]; then
CMAKE_ARGS+=("-DGLOW_WITH_OPENCL=OFF")
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Release")
elif [[ "$CIRCLE_JOB" == "COVERAGE" ]]; then
sudo apt-get install wget
sudo apt-get install -y lcov
sudo yum install -y wget
sudo yum install -y lcov
sudo pip install awscli --upgrade
../utils/install_protobuf.sh
CC=gcc-5 CXX=g++-5 cmake -G Ninja \
Expand All @@ -141,10 +153,10 @@ elif [[ "$CIRCLE_JOB" == "COVERAGE" ]]; then
-DGLOW_USE_COVERAGE=ON \
../
elif [[ "$CIRCLE_JOB" == "CHECK_CLANG_AND_PEP8_FORMAT" ]]; then
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-11 main"
sudo apt-get update
sudo apt-get install -y clang-format-11
#sudo rpm --import https://apt.llvm.org/llvm-snapshot.gpg.key
#sudo yum-config-manager --add-repo http://apt.llvm.org/xenial/llvm-toolchain-xenial-11.repo
#sudo yum update
sudo yum install -y clang-devel
cd /tmp
python3.9 -m virtualenv venv
source venv/bin/activate
Expand All @@ -166,6 +178,8 @@ else
fi

if [ "${CIRCLE_JOB}" != "COVERAGE" ] && [ "${CIRCLE_JOB}" != "CHECK_CLANG_AND_PEP8_FORMAT" ] && [ "${CIRCLE_JOB}" != "PYTORCH" ]; then
echo ${CMAKE_ARGS[*]}
# sleep 2h
cmake -GNinja ${CMAKE_ARGS[*]} ../
ninja
fi
Expand Down
Empty file modified .github/test.sh
100644 → 100755
Empty file.
16 changes: 8 additions & 8 deletions .github/workflows/glow-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
repository: pytorch/glow
timeout: 120
script: |
# temporarily get the job green before we complete the migration.
exit 0
echo '::group::Setup Environment Variables'
# Mark Build Directory Safe
git config --global --add safe.directory /__w/glow/glow
Expand All @@ -31,20 +29,22 @@ jobs:
fi

original_pwd=$(pwd)
sudo apt-get update;
# sudo yum update
mkdir ~/tempdownload;
cd ~/tempdownload;
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.1p1.tar.gz;
tar zxvf openssh-8.1p1.tar.gz;
cd openssh-8.1p1 && ./configure && make && sudo make install;
tar zxf openssh-8.1p1.tar.gz;
cd openssh-8.1p1 &&
./configure &&
make > /dev/null &&
sudo make install;

cd $original_pwd
git submodule sync
git submodule update --recursive --init

set -e
# Build
chmod +x .github/build.sh .github/test.sh
export CIRCLE_JOB=OPENCL
.github/build.sh

# Test
.github/test.sh
5 changes: 5 additions & 0 deletions lib/LLVMIRCodeGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ add_library(LLVMIRCodeGen
LLVMIRGen.cpp
LLVMBackend.cpp)

find_package(LLVM REQUIRED CONFIG)

include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})

llvm_map_components_to_libnames(LLVM_TARGET_LIBRARIES ${LLVM_TARGETS_TO_BUILD})
target_link_libraries(LLVMIRCodeGen
PUBLIC
Expand Down
Loading