Skip to content

Commit

Permalink
[cross] adaptive job number
Browse files Browse the repository at this point in the history
  • Loading branch information
sktometometo committed Oct 13, 2023
1 parent 909c9ef commit d57ead7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 7 additions & 2 deletions jsk_unitree_robot/cross/build_ros1.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash

# From https://qiita.com/ymdymd/items/312c9f554d4ffb1f8dc6
JOBS=$(($(grep cpu.cores /proc/cpuinfo | sort -u | sed 's/[^0-9]//g') + 1))
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

TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System
Expand Down
11 changes: 9 additions & 2 deletions jsk_unitree_robot/cross/build_ros1_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/bash

# From https://qiita.com/ymdymd/items/312c9f554d4ffb1f8dc6
JOBS=$(($(grep cpu.cores /proc/cpuinfo | sort -u | sed 's/[^0-9]//g') + 1))
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

TARGET_MACHINE="${TARGET_MACHINE:-arm64v8}"
HOST_INSTALL_ROOT="${BASE_ROOT:-${PWD}}/"${TARGET_MACHINE}_System
Expand Down

0 comments on commit d57ead7

Please sign in to comment.