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

[Unitree][cross] set make job num to CPU threads #1873

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
16 changes: 13 additions & 3 deletions jsk_unitree_robot/cross/build_ros1.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/bin/bash

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
JOBS=$(cat /proc/cpuinfo | grep "processor" | wc -l)
elif [[ "$OSTYPE" == "darwin"* ]]; then
JOBS=$(sysctl -n hw.logicalcpu)
else
JOBS=8
fi

echo "NUM JOBS=${JOBS}"

TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System
INSTALL_ROOT=System
SOURCE_ROOT=${TARGET_MACHINE}_ws_system
MAKEFLAGS=${MAKEFLAGS:-'-j4'}
MAKEFLAGS=${MAKEFLAGS:-'-j'}${JOBS}

UPDATE_SOURCE_ROOT=1 # TRUE
if [ -e "${SOURCE_ROOT}" ]; then
Expand All @@ -31,7 +41,7 @@ mkdir -p ${SOURCE_ROOT}/src
mkdir -p ${HOST_INSTALL_ROOT}/ros1_inst

if [ ${UPDATE_SOURCE_ROOT} -eq 1 ]; then
vcs import --force --retry 10 --shallow ${SOURCE_ROOT}/src < repos/roseus_no_window.repos
vcs import --force --workers ${JOBS} --retry 10 --shallow ${SOURCE_ROOT}/src < repos/roseus_no_window.repos
for dir in euslisp jskeus; do ls ${SOURCE_ROOT}/src/$dir/patches/; rsync -avz ${SOURCE_ROOT}/src/$dir/patches/ ${SOURCE_ROOT}/src/$dir; done
sed -i s@:{version}@0.0.0@ ${SOURCE_ROOT}/src/euslisp/package.xml ${SOURCE_ROOT}/src/jskeus/package.xml
fi
Expand Down Expand Up @@ -63,7 +73,7 @@ docker run -it --rm \
rospack list && \
cd ${SOURCE_ROOT} && \
[ ${UPDATE_SOURCE_ROOT} -eq 0 ] || ROS_PACKAGE_PATH=src:\$ROS_PACKAGE_PATH rosinstall_generator ${EUSCOLLADA_DEPENDS} ${ROSEUS_DEPENDS} ${ROSEUS_MONGO_DEPENDS} ${ROSEUS_SMACH_DEPENDS} ${JSK_ROBOT_STARTUP_DEPENDS} ${DIAGNOSTIC_AGGREGATOR} ${PR2EUS} --verbose --deps --rosdistro melodic --exclude RPP --depend-type buildtool buildtool_export build run | tee unitree_ros1_system.repos && \
[ ${UPDATE_SOURCE_ROOT} -eq 0 ] || PYTHONPATH= vcs import --force --retry 10 --shallow src < unitree_ros1_system.repos && \
[ ${UPDATE_SOURCE_ROOT} -eq 0 ] || PYTHONPATH= vcs import --force --workers ${JOBS} --retry 10 --shallow src < unitree_ros1_system.repos && \
[ ! -e pr2_mechanism-346.diff ] || OUT=\"\$(patch -p1 --forward --directory src/pr2_mechanism < pr2_mechanism-346.diff | tee /dev/tty)\" || echo \"\${OUT}\" | grep \"Skipping patch\" -q || (echo \"\$OUT\" && false) && \
catkin_make_isolated --install --install-space /opt/jsk/${INSTALL_ROOT}/ros1_inst -DCMAKE_BUILD_TYPE=Release \
-DCATKIN_ENABLE_TESTING=FALSE \
Expand Down
18 changes: 16 additions & 2 deletions jsk_unitree_robot/cross/build_ros1_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
#!/bin/bash

IMAGE_NAME="${IMAGE_NAME:-ros1-unitree}"

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
JOBS=$(cat /proc/cpuinfo | grep "processor" | wc -l)
elif [[ "$OSTYPE" == "darwin"* ]]; then
JOBS=$(sysctl -n hw.logicalcpu)
else
JOBS=8
fi

echo "NUM JOBS=${JOBS}"

TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System
INSTALL_ROOT=System
SOURCE_ROOT=${TARGET_MACHINE}_ws_ros1_dependencies_sources
MAKEFLAGS=${MAKEFLAGS:-'-j4'}
MAKEFLAGS=${MAKEFLAGS:-'-j'}${JOBS}

if [ -e "${SOURCE_ROOT}" ]; then
echo "WARNING: Source directory is found ${SOURCE_ROOT}" 1>&2
Expand Down Expand Up @@ -38,7 +50,9 @@ docker run -it --rm \
bash -c "\
set -xeuf -o pipefail && \
cd /home/user/ros1_dependencies_sources && \
vcs import --skip-existing --retry 10 --shallow src < ros1_dependencies.repos && \
vcs import --skip-existing --workers ${JOBS} --retry 10 --shallow src < ros1_dependencies.repos && \
export JOBS=${JOBS} && \
export MAKEFLAGS=${MAKEFLAGS} && \
for script_file in \$(ls /home/user/ros1_dependencies_build_scripts/|sort); do
/home/user/ros1_dependencies_build_scripts/\$script_file || exit 1;
done && \
Expand Down
12 changes: 11 additions & 1 deletion jsk_unitree_robot/cross/build_user.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/bin/bash

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
JOBS=$(cat /proc/cpuinfo | grep "processor" | wc -l)
elif [[ "$OSTYPE" == "darwin"* ]]; then
JOBS=$(sysctl -n hw.logicalcpu)
else
JOBS=8
fi

echo "NUM JOBS=${JOBS}"

TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System
INSTALL_ROOT=System
Expand Down Expand Up @@ -35,7 +45,7 @@ for dir in $(find ${SOURCE_ROOT}/src/jsk_robot -maxdepth 1 -mindepth 1 -type d);
done

# add unitree repos
[ ${UPDATE_SOURCE_ROOT} -eq 0 ] || vcs import ${SOURCE_ROOT}/src < repos/unitree.repos
[ ${UPDATE_SOURCE_ROOT} -eq 0 ] || vcs import --workers ${JOBS} ${SOURCE_ROOT}/src < repos/unitree.repos

# check if /proc/sys/fs/binfmt_misc/qemu-* is updated
# See https://github.com/k-okada/jsk_robot/issues/61
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cd /home/user/ros1_dependencies_sources/build/urdfdom-headers
cmake \
-DCMAKE_INSTALL_PREFIX=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies \
-DCMAKE_BUILD_TYPE=Release \
-j ${JOBS} \
../../src/urdfdom-headers/urdfdom_headers-1.0.0

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cd /home/user/ros1_dependencies_sources/build/urdfdom
cmake \
-DCMAKE_INSTALL_PREFIX=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies \
-DCMAKE_BUILD_TYPE=Release \
-j ${JOBS} \
../../src/urdfdom/urdfdom-1.0.0

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cmake \
-DBUILD_DOCS=OFF \
-DCMAKE_DEBUG_POSTFIX='' \
-DASSIMP_ENABLE_BOOST_WORKAROUND=OFF \
-j ${JOBS} \
${SOURCE_DIR}

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ cmake \
-DOPT_DOUBLE_PRECISION=ON \
${SOURCE_DIR}

# ${MAKEFLAGS} causes error?
make install
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DYAML_CPP_BUILD_TOOLS=ON \
-j ${JOBS} \
${SOURCE_DIR}

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cmake \
-DCMAKE_INSTALL_PREFIX=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=on \
-j ${JOBS} \
${SOURCE_DIR}

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ cmake \
-DWITH_OPENEXR=OFF \
-DPYTHON2_PACKAGES_PATH=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib/python2.7/site-packages \
-DOPENCV_CONFIG_INSTALL_PATH=lib/cmake/OpenCV \
-j ${JOBS} \
${SOURCE_DIR}

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ python \
-e /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/include \
-b /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/bin \

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ automake --add-missing
autoconf
./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ cd ${SOURCE_DIR}

./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ cd ${SOURCE_DIR}/build_unix

../dist/configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies --build $(uname -m)-unknown-linux-gnu --enable-cxx --enable-compat185

# Why j1?
make -j1 install
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ cd ${SOURCE_DIR}
./autogen.sh
CFLAGS="-I/opt/jsk/${INSTALL_ROOT}/ros1_dependencies/include" LIBS="-L/opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib" ./configure --enable-force-install --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ cmake \
-DCMAKE_BUILD_TYPE=Release \
${SOURCE_DIR}

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ automake --add-missing
autoconf
./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ cd ${SOURCE_DIR}

./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies -with-shared

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export PROJECT_MAJOR_VERSION=2

./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

# Why j1?
make -j1 PULSEAUDIO=none

cp lib/*.a /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/lib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ libtoolize
autoconf
./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

# Why j1 ?
EST="../speech_tools" make -j1 all

cp src/main/festival src/main/festival_client bin/text2wave /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/bin/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi
##

cd ${SOURCE_DIR}
make -C lib/dicts/cmu
make -C lib/dicts/cmu ${MAKEFLAGS}

mkdir -p /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/share/festival/dicts/cmu
cp lib/dicts/cmu/cmudict-*.out /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/share/festival/dicts/cmu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ cd ${SOURCE_DIR}

./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ cd ${SOURCE_DIR}

./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ cd ${SOURCE_DIR}

./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies --build=arm --verbose --enable-shared --exec-prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

make
make install
make ${MAKEFLAGS}
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cd ${SOURCE_DIR}

./config --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies --openssldir=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies/openssl

make
make install
make ${MAKEFLAGS}
make install ${MAKEFLAGS}

# download pem (ssl.get_default_verify_paths)
wget https://curl.haxx.se/ca/cacert.pem -O /opt/jsk/${INSTALL_ROOT}/ros1_dependencies/openssl/cert.pem
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ cd ${SOURCE_DIR}

./configure --prefix=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ make makefiles \
-I${INSTALL_DIR}/include/openssl" \
AUXLIBS="-L${INSTALL_DIR}/lib -L${INSTALL_DIR}/lib/sasl2 -L${INSTALL_DIR}/openssl -lsasl2 -lssl -lcrypto -lz -lm"

make
make ${MAKEFLAGS}
LD_LIBRARY_PATH="${INSTALL_DIR}"/lib "${INSTALL_DIR}"/bin/expect -c "
set timeout 100
spawn make install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cmake \
-DCMAKE_INSTALL_PREFIX=/opt/jsk/${INSTALL_ROOT}/ros1_dependencies \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=ON \
-j ${JOBS} \
${SOURCE_DIR}

make install
make install ${MAKEFLAGS}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=ON \
-DFCL_BUILD_TESTS=FALSE \
-j ${JOBS} \
${SOURCE_DIR}

make install
make install ${MAKEFLAGS}
Loading