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

CUDA & compression #267

Merged
merged 49 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f269db0
CUDA & compression
harold-b Feb 8, 2023
acef7a8
Updated README w/ current GPU requirements
haorldbchi Feb 10, 2023
bddcd06
Trivial README fixes
haorldbchi Feb 10, 2023
a852839
Add proper CMake CUDA support
harold-b Feb 10, 2023
221fb88
Fixes device selection
harold-b Feb 15, 2023
b40fce7
Harester decompressor update and farming simulator
harold-b Mar 4, 2023
ae066d3
Alpha bump
haorldbchi Mar 5, 2023
bf713ad
Allow Thread::WaitForExit on macos
harold-b Mar 7, 2023
d133345
Fix build issues on Windows
haorldbchi Mar 7, 2023
27fdd38
Fixed ANS values and park size for c1-3
harold-b Mar 9, 2023
11453ec
Merge remote-tracking branch 'cuda-compression' into cuda-compression
harold-b Mar 9, 2023
d1779fd
Windows workaround
haorldbchi Mar 9, 2023
eb6df03
v3 Alpha3 bump
harold-b Mar 9, 2023
8163889
GreenReaper API to preallocate compression buffers
harold-b Mar 14, 2023
cc5390e
Add worse proof lookup to simulator.
harold-b Mar 16, 2023
1b3b6ae
New `check` command, similar
harold-b Mar 11, 2023
bff4182
Adding power usage mode to simulator
harold-b Mar 16, 2023
f1373a2
Fix power usage simulator
harold-b Mar 21, 2023
21e4a08
Fix error or windows
harold-b Mar 21, 2023
40f7d47
Workaround for PlotSerializer issue
harold-b Apr 18, 2023
e08ee8c
CUDA harvesting (#8)
haorldbchi Apr 21, 2023
ec28f18
V3 alpha4 fixes (#318)
haorldbchi May 9, 2023
b055a9e
Fixes for windows build
haorldbchi May 10, 2023
80db0e5
Missing sources
haorldbchi May 10, 2023
4f889c4
Fixes for windows bladebit_cuda and validation
haorldbchi May 11, 2023
85c7654
Adding harvester build changes (#320)
wallentx May 12, 2023
c3a31eb
Windows CUDA CI
haorldbchi May 12, 2023
a1c1642
Update Harvester.cmake (#327)
wallentx May 15, 2023
ba7d0df
adding gencode fix for linker (#336)
wallentx May 30, 2023
7a02164
Fixing arm64 conditional (#337)
wallentx May 30, 2023
3c7dfff
Testing m1 mac builds (#340)
wallentx Jun 7, 2023
bb9a06b
Update FindCatch2.cmake
wallentx Jun 24, 2023
84ca1c3
Change GreenReaper target to be static lib by default (#346)
haorldbchi Jun 26, 2023
aa18ffa
Merge pull request #344 from Chia-Network/wallentx/catch2
haorldbchi Jun 26, 2023
6ab28ed
Update bls-signatures (#343)
wallentx Jun 26, 2023
aee1b64
Fix cuda compression device lost (#347)
haorldbchi Jun 30, 2023
c0216c9
Fix allocating more vRAM than needed
haorldbchi Jul 2, 2023
1e5eb6e
Disable virtual mem warnings on macos harvester
haorldbchi Jul 14, 2023
a71336e
Stack trace dump on Windows and VirtualFreeissue (#351)
haorldbchi Jul 19, 2023
ef2c22f
Fix green reaper leak on releasing buffers
haorldbchi Jul 20, 2023
8b248fc
Fix Linux build fail after bbvirtfreebounded change
haorldbchi Jul 20, 2023
9a76049
Shrinking cuda install, add all assets to attach (#352)
wallentx Jul 21, 2023
b5860ec
Add CentOS arm64 CI for bladebit (#353)
wallentx Jul 22, 2023
446af95
Remove bladebit-macos artifact reference
wallentx Jul 22, 2023
e5fb865
Adding gencode for Orin
wallentx Jul 27, 2023
4433393
Merge pull request #358 from Chia-Network/wallentx/sm_87
haorldbchi Jul 27, 2023
aab2371
Update some virtual free call sites
haorldbchi Jul 28, 2023
35fe5cc
Make fatlib (#361)
wallentx Aug 3, 2023
9a69d30
Return cuobjdump info on artifacts, future-proofing CI (#362)
wallentx Aug 4, 2023
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
54 changes: 39 additions & 15 deletions .github/actions/build-asset-unix.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
#! /usr/bin/env bash
# NOTE: This is meant to be run from the repo root dir
#
# Expects env variables:
# - BB_ARTIFACT_NAME
# - BB_VERSION
#

set -eo pipefail

compile_cuda=0
artifact_name=bladebit
version=v1.0

while true; do
case $1 in
--cuda)
compile_cuda=1 || exit 1
;;
--artifact)
shift && artifact_name=$1 || exit 1
;;
--version)
shift && version=$1 || exit 1
;;
esac
shift || break
done


thread_count=2

if [[ $OSTYPE == 'darwin'* ]]; then
Expand All @@ -19,11 +35,19 @@ fi
echo "System: $(uname -s)"
gcc --version

mkdir build && cd build
cmake ..
exe_name=bladebit
target=bladebit
if [[ compile_cuda -eq 1 ]]; then
target=bladebit_cuda
exe_name=bladebit_cuda
fi

set -x
mkdir build-${target} && cd build-${target}
cmake .. -DCMAKE_BUILD_TYPE=Release
bash -eo pipefail ../embed-version.sh
cmake --build . --target bladebit --config Release -j $thread_count
chmod +x ./bladebit
cmake --build . --config Release --target $target -j $thread_count
chmod +x ./${exe_name}

if [[ $OSTYPE == 'msys'* ]] || [[ $OSTYPE == 'cygwin'* ]]; then
ls -la Release
Expand All @@ -32,16 +56,16 @@ else
fi

# Ensure bladebit version matches expected version
bb_version="$(./bladebit --version | xargs)"
bb_version="$(./${exe_name} --version | xargs)"

if [[ "$bb_version" != "$BB_VERSION" ]]; then
>&2 echo "Incorrect bladebit version. Got '$bb_version' but expected '$BB_VERSION'."
if [[ "$bb_version" != "$version" ]]; then
>&2 echo "Incorrect bladebit version. Got '$bb_version' but expected '$version'."
exit 1
fi

tar --version
tar -czvf $BB_ARTIFACT_NAME bladebit
mkdir ../bin
mv $BB_ARTIFACT_NAME ../bin/
tar -czvf $artifact_name $exe_name
mkdir -p ../bin
mv $artifact_name ../bin/
ls -la ../bin

113 changes: 113 additions & 0 deletions .github/actions/build-harvester.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ $RUNNER_DEBUG = 1 ]]; then
set -x
fi

host_os=$(uname -a)
case "${host_os}" in
Linux*) host_os="linux";;
Darwin*) host_os="macos";;
CYGWIN*) host_os="windows";;
MINGW*) host_os="windows";;
*Msys) host_os="windows";;
esac

if [[ "$host_os" == "windows" ]]; then
ext="zip"
else
ext="tar.gz"
fi

if [[ "$host_os" == "macos" ]]; then
procs=$(sysctl -n hw.logicalcpu)
sha_sum="shasum -a 256"
else
procs=$(nproc --all)
sha_sum="sha256sum"
fi

artifact_name=green_reaper.$ext

while true; do
case $1 in
--artifact)
shift && artifact_name=$1 || exit 1
;;
esac
shift || break
done

echo "Harvester artifact: ${artifact_name}"
echo 'cmake --version'
cmake --version

mkdir -p build-harvester
pushd build-harvester
cmake .. -DCMAKE_BUILD_TYPE=Release -DBB_HARVESTER_ONLY=ON

cmake --build . --config Release --target bladebit_harvester

if [[ "$host_os" == "windows" ]]; then
OBJDUMP=$("${CUDA_PATH}"\\bin\\cuobjdump Release\\bladebit_harvester.dll)
elif [[ "$host_os" == "linux" ]]; then
OBJDUMP=$(/usr/local/cuda/bin/cuobjdump libbladebit_harvester.so)
fi

cmake --install . --prefix harvester_dist
pushd harvester_dist/green_reaper

if [[ "$host_os" == "windows" ]]; then
mkdir -p lib
cp -vn ../../*/*.dll lib/
cp -vn ../../*/*.lib lib/
fi

artifact_files=($(find . -type f -name '*.*' | cut -c3-))

# shellcheck disable=SC2068
$sha_sum ${artifact_files[@]} > sha256checksum

artifact_files+=("sha256checksum")

if [[ "$host_os" == "windows" ]]; then
7z.exe a -tzip "${artifact_name}" "${artifact_files[@]}"
else
# shellcheck disable=SC2068
tar -czvf "${artifact_name}" ${artifact_files[@]}
fi

popd
mv "harvester_dist/green_reaper/${artifact_name}" ./
$sha_sum "${artifact_name}" > "${artifact_name}.sha256.txt"
ls -la
cat "${artifact_name}.sha256.txt"

if [[ "$CI" == "true" ]]; then
if [[ "$host_os" == "windows" ]] || [[ "$host_os" == "linux" ]]; then
while IFS= read -r line; do
echo -e "$(echo ${line#* } | tr -d '*')\n###### <sup>${line%% *}</sup>\n"
done <"${artifact_name}.sha256.txt" >> "$GITHUB_STEP_SUMMARY"
echo "| Arch | Code Version | Host | Compile Size |" >> "$GITHUB_STEP_SUMMARY"
echo "| --- | --- | --- | --- |" >> "$GITHUB_STEP_SUMMARY"
echo "$OBJDUMP" | awk -v RS= -v FS='\n' -v OFS=' | ' '{
for (i=1; i<=NF; i++) {
if (index($i, "=")) {
gsub(/.* = /, "", $i);
}
}
print $3, $4, $5, $6;
}' | sed 's/^/| /; s/$/ |/; s/ | | / | /g' >> "$GITHUB_STEP_SUMMARY"
fi

if [[ "$host_os" == "windows" ]]; then
harvester_artifact_path="$(cygpath -m "$(pwd)/${artifact_name}")*"
else
harvester_artifact_path="$(pwd)/${artifact_name}*"
fi
echo "harvester_artifact_path=$harvester_artifact_path"
echo "harvester_artifact_path=$harvester_artifact_path" >> "$GITHUB_ENV"
fi

popd
ls -la
6 changes: 4 additions & 2 deletions .github/actions/get-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ if [[ "$os" == "windows" ]]; then
ext="zip"
fi

echo "::set-output name=BB_VERSION::$version"
echo "::set-output name=BB_ARTIFACT_NAME::bladebit-v${version}-${os}-${arch}.${ext}"
echo "BB_VERSION=$version" >> $GITHUB_ENV
echo "BB_ARTIFACT_NAME=bladebit-v${version}-${os}-${arch}.${ext}" >> $GITHUB_ENV
echo "BB_ARTIFACT_NAME_CUDA=bladebit-cuda-v${version}-${os}-${arch}.${ext}" >> $GITHUB_ENV


33 changes: 33 additions & 0 deletions .github/actions/install-cmake-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -eo pipefail
ref_cmake_sha256='39e1c2eccda989b0d000dc5f4ee2cb031bdda799163780d855acc0bd9eda9d92'
cmake_name='cmake-3.23.3-linux-x86_64'

curl -L https://github.com/Kitware/CMake/releases/download/v3.23.3/cmake-3.23.3-linux-x86_64.tar.gz > cmake.tar.gz

cmake_sh_sha256=$(sha256sum cmake.tar.gz | cut -f1 -d' ')
if [[ "${ref_cmake_sha256}" != "${cmake_sh_sha256}" ]]; then
2>&1 echo "sha256 mismatch!: "
2>&1 echo "Got : '${cmake_sh_sha256}'"
2>&1 echo "Expected: '${ref_cmake_sha256}'"
exit 1
fi

rm -f /usr/bin/cmake && rm -f /usr/local/bin/cmake
mkdir -p /usr/local/bin
mkdir -p /usr/local/share

cmake_prefix=$(pwd)/${cmake_name}
tar -xzvf cmake.tar.gz
ls -la
ls -la ${cmake_prefix}

cp -r ${cmake_prefix}/bin/* /usr/local/bin/
cp -r ${cmake_prefix}/share/* /usr/local/share/

echo 'Cmake Info:'
which cmake
cmake --version

echo 'Done.'
exit 0
13 changes: 10 additions & 3 deletions .github/workflows/attach-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ jobs:
bladebit-v${BB_VERSION}-ubuntu-arm64.tar.gz
bladebit-v${BB_VERSION}-centos-arm64.tar.gz
bladebit-v${BB_VERSION}-windows-x86-64.zip
bladebit-v${BB_VERSION}-macos-arm64.tar.gz
bladebit-v${BB_VERSION}-macos-x86-64.tar.gz
bladebit-cuda-v${BB_VERSION}-ubuntu-x86-64.tar.gz
bladebit-cuda-v${BB_VERSION}-centos-x86-64.tar.gz
bladebit-cuda-v${BB_VERSION}-ubuntu-arm64.tar.gz
bladebit-cuda-v${BB_VERSION}-windows-x86-64.zip
green_reaper-v${BB_VERSION}-linux-x86-64.tar.gz
green_reaper-v${BB_VERSION}-linux-ARM64.tar.gz
green_reaper-v${BB_VERSION}-macos-x86-64.tar.gz
green_reaper-v${BB_VERSION}-macos-arm64.tar.gz
green_reaper-v${BB_VERSION}-windows-x86-64.zip
)

mkdir -p bin
Expand All @@ -59,4 +66,4 @@ jobs:
echo "Uploading release asset '${artifact_name}'"
node .github/actions/artifacts.mjs upload-release-asset $BB_VERSION $artifact_name bin/$artifact_name
done

Loading