Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into IFU-master-2024-03-28
Browse files Browse the repository at this point in the history
  • Loading branch information
pnunna93 committed Apr 4, 2024
2 parents a36bd1d + fd9d072 commit a551c16
Show file tree
Hide file tree
Showing 136 changed files with 7,332 additions and 3,541 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*]
trim_trailing_whitespace = true
insert_final_newline = true
14 changes: 14 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ran black and isort for coherent code formatting
bfa0e33294f2b1dc25e65a33be2397f989824298

# reran black with linelength 80 for greater readability
ea7c14f8ef64924f2d0ff80df3cdabf2c7299848

# Remove f-prefix from strings that don't use formatting
7727fa4c8c6c1ef2b109120aff4196a0a6bf3ed6

# format tests/linear_4bit.py
34735ba89de8235ea9da6ef409f814dcea9e2038

# Reformat with ruff-format
5a4263f4dc05fe8f78f4111beab9f68a81deeab1
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ body:
label: Reproduction
description: |
Please provide a code sample that reproduces the problem you ran into. It can be a Colab link or just a code snippet.
Please provide the simplest reproducer as possible so that we can quickly fix the issue.
Please provide the simplest reproducer as possible so that we can quickly fix the issue.
placeholder: |
Reproducer:
Reproducer:
- type: textarea
id: expected-behavior
validations:
required: true
attributes:
label: Expected behavior
description: "A clear and concise description of what you would expect to happen."
description: "A clear and concise description of what you would expect to happen."
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "\U0001F680 Feature request"
description: Submit a proposal/request for a new feature
labels: [ "feature" ]
labels: ["feature"]
body:
- type: textarea
id: feature-request
Expand All @@ -18,7 +18,7 @@ body:
attributes:
label: Motivation
description: |
Please outline the motivation for the proposal. Is your feature request related to a problem?
Please outline the motivation for the proposal. Is your feature request related to a problem?
- type: textarea
id: contribution
Expand All @@ -27,4 +27,4 @@ body:
attributes:
label: Your contribution
description: |
Is there any way that you could help, e.g. by submitting a PR?
Is there any way that you could help, e.g. by submitting a PR?
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: "weekly"
groups:
major:
update-types: [major]
minor-patch:
update-types: [minor, patch]
31 changes: 31 additions & 0 deletions .github/scripts/auditwheel_show.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import argparse
import subprocess


def main():
ap = argparse.ArgumentParser()
ap.add_argument("wheels", nargs="*")
args = ap.parse_args()
if not args.wheels:
ap.error("At least one wheel must be provided.")
for whl in args.wheels:
print(f"### `{whl}`")

audit_wheel_output = subprocess.run(
["auditwheel", "show", whl],
capture_output=True,
text=True,
errors="backslashreplace",
)

if audit_wheel_output.stdout:
print(audit_wheel_output.stdout)

if audit_wheel_output.stderr:
print(f"**Error:**\n```{audit_wheel_output.stderr}```")

print("---")


if __name__ == "__main__":
main()
23 changes: 23 additions & 0 deletions .github/scripts/build-cpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
declare build_arch
declare build_os

set -xeuo pipefail

pip install cmake==3.28.3

if [ "${build_os:0:6}" == ubuntu ] && [ "${build_arch}" == aarch64 ]; then
# Allow cross-compile on aarch64
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
cmake -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCOMPUTE_BACKEND=cpu .
elif [ "${build_os:0:5}" == macos ] && [ "${build_arch}" == aarch64 ]; then
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCOMPUTE_BACKEND=cpu .
else
cmake -DCOMPUTE_BACKEND=cpu .
fi
cmake --build . --config Release

output_dir="output/${build_os}/${build_arch}"
mkdir -p "${output_dir}"
(shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} "${output_dir}")
29 changes: 29 additions & 0 deletions .github/scripts/build-cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
declare build_arch
declare build_os
declare cuda_version

set -xeuo pipefail
build_capability="50;52;60;61;70;75;80;86;89;90"
[[ "${cuda_version}" == 11.7.* ]] && build_capability=${build_capability%??????}
[[ "${cuda_version}" == 11.8.* ]] && build_capability=${build_capability%???}
[[ "${build_os}" = windows-* ]] && python3 -m pip install ninja
for NO_CUBLASLT in ON OFF; do
if [ "${build_os:0:6}" == ubuntu ]; then
image=nvidia/cuda:${cuda_version}-devel-ubuntu22.04
echo "Using image $image"
docker run --platform "linux/$build_arch" -i -w /src -v "$PWD:/src" "$image" sh -c \
"apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cmake \
&& cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" -DNO_CUBLASLT=${NO_CUBLASLT} . \
&& cmake --build ."
else
pip install cmake==3.28.3
cmake -G Ninja -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY="${build_capability}" -DNO_CUBLASLT=${NO_CUBLASLT} -DCMAKE_BUILD_TYPE=Release -S .
cmake --build . --config Release
fi
done

output_dir="output/${build_os}/${build_arch}"
mkdir -p "${output_dir}"
(shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} "${output_dir}")
32 changes: 32 additions & 0 deletions .github/scripts/set_platform_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import argparse
import platform
import sys


def get_platform_tag(architecture):
system = platform.system()

if system == "Linux":
tag = "manylinux_2_24_x86_64" if architecture == "x86_64" else "manylinux_2_24_aarch64"
elif system == "Darwin":
tag = "macosx_13_1_x86_64" if architecture == "x86_64" else "macosx_13_1_arm64"
elif system == "Windows":
tag = "win_amd64" if architecture == "x86_64" else "win_arm64"
else:
sys.exit(f"Unsupported system: {system}")

return tag


def main():
parser = argparse.ArgumentParser(description="Determine platform tag.")
parser.add_argument("arch", type=str, help="Architecture (e.g., x86_64, aarch64)")
args = parser.parse_args()

tag = get_platform_tag(args.arch)

print(tag) # This will be captured by the GitHub Actions workflow


if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions .github/workflows/build_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:
- v*-release

jobs:
build:
build:
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
with:
commit_sha: ${{ github.sha }}
package: bitsandbytes
repo_owner: TimDettmers
secrets:
token: ${{ secrets.HUGGINGFACE_PUSH }}
hf_token: ${{ secrets.HUGGINGFACE_PUSH }}
3 changes: 2 additions & 1 deletion .github/workflows/build_pr_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ concurrency:

jobs:
build:
if: github.repository == 'TimDettmers/bitsandbytes'
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
with:
commit_sha: ${{ github.event.pull_request.head.sha }}
pr_number: ${{ github.event.number }}
package: bitsandbytes
repo_owner: TimDettmers
repo_owner: TimDettmers
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- uses: pre-commit/action@v3.0.0
env:
RUFF_OUTPUT_FORMAT: github
Loading

0 comments on commit a551c16

Please sign in to comment.