Commit 4a6ea7e2 authored by Tim Dettmers's avatar Tim Dettmers
Browse files

Added adjusted build file.

parent 28d1e7dc
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
ROOT_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH))) ROOT_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
ifndef CUDA_VERSION
$(error ERROR: CUDA_VERSION not set. Call make with CUDA string, for example: make cuda11x CUDA_VERSION=115 or make cpuonly CUDA_VERSION=CPU)
endif
GPP:= /usr/bin/g++ GPP:= /usr/bin/g++
ifeq ($(CUDA_HOME),) ifeq ($(CUDA_HOME),)
CUDA_HOME:= $(shell which nvcc | rev | cut -d'/' -f3- | rev) CUDA_HOME:= $(shell which nvcc | rev | cut -d'/' -f3- | rev)
endif endif
ifndef CUDA_VERSION
$(warning WARNING: CUDA_VERSION not set. Call make with CUDA string, for example: make cuda11x CUDA_VERSION=115 or make cpuonly CUDA_VERSION=CPU)
CUDA_VERSION:=
endif
NVCC := $(CUDA_HOME)/bin/nvcc NVCC := $(CUDA_HOME)/bin/nvcc
...@@ -92,7 +93,7 @@ cuda11x: $(BUILD_DIR) env ...@@ -92,7 +93,7 @@ cuda11x: $(BUILD_DIR) env
$(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION).so $(LIB) $(GPP) -std=c++14 -DBUILD_CUDA -shared -fPIC $(INCLUDE) $(BUILD_DIR)/ops.o $(BUILD_DIR)/kernels.o $(BUILD_DIR)/link.o $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cuda$(CUDA_VERSION).so $(LIB)
cpuonly: $(BUILD_DIR) env cpuonly: $(BUILD_DIR) env
$(GPP) -std=c++14 -shared -fPIC -I $(ROOT_DIR)/csrc -I $(ROOT_DIR)/include $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_$(CUDA_VERSION).so $(GPP) -std=c++14 -shared -fPIC -I $(ROOT_DIR)/csrc -I $(ROOT_DIR)/include $(FILES_CPP) -o ./bitsandbytes/libbitsandbytes_cpu.so
env: env:
@echo "ENVIRONMENT" @echo "ENVIRONMENT"
...@@ -116,7 +117,10 @@ $(ROOT_DIR)/dependencies/cub: ...@@ -116,7 +117,10 @@ $(ROOT_DIR)/dependencies/cub:
cd dependencies/cub; git checkout 1.11.0 cd dependencies/cub; git checkout 1.11.0
clean: clean:
rm build/* ./bitsandbytes/libbitsandbytes.so rm build/*
cleaneggs: cleaneggs:
rm -rf *.egg* rm -rf *.egg*
cleanlibs:
rm ./bitsandbytes/libbitsandbytes*.so
...@@ -15,12 +15,14 @@ module unload gcc ...@@ -15,12 +15,14 @@ module unload gcc
rm -rf dist build rm -rf dist build
make cleaneggs make cleaneggs
make cleanlibs
make clean make clean
export CUDA_HOME= export CUDA_HOME=
make cpuonly CUDA_VERSION=CPU export CUDA_VERSION=
make cpuonly CUDA_VERSION="CPU"
if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then if [ ! -f "./bitsandbytes/libbitsandbytes_cpu.so" ]; then
# Control will enter here if $DIRECTORY doesn't exist. # Control will enter here if $DIRECTORY doesn't exist.
echo "Compilation unsuccessul!" 1>&2 echo "Compilation unsuccessul!" 1>&2
exit 64 exit 64
...@@ -30,188 +32,174 @@ make clean ...@@ -30,188 +32,174 @@ make clean
export CUDA_HOME=$BASE_PATH/cuda-11.0 export CUDA_HOME=$BASE_PATH/cuda-11.0
make cuda110 CUDA_VERSION=110 make cuda110 CUDA_VERSION=110
if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then if [ ! -f "./bitsandbytes/libbitsandbytes_cuda110.so" ]; then
# Control will enter here if $DIRECTORY doesn't exist. # Control will enter here if $DIRECTORY doesn't exist.
echo "Compilation unsuccessul!" 1>&2 echo "Compilation unsuccessul!" 1>&2
exit 64 exit 64
fi fi
#make clean make clean
#export CUDA_HOME=$BASE_PATH/cuda-11.1 export CUDA_HOME=$BASE_PATH/cuda-11.1
#make cuda11x CUDA_VERSION=111 make cuda11x CUDA_VERSION=111
#
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then if [ ! -f "./bitsandbytes/libbitsandbytes_cuda111.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist. # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2 echo "Compilation unsuccessul!" 1>&2
# exit 64 exit 64
#fi fi
#
#make clean make clean
#export CUDA_HOME=$BASE_PATH/cuda-11.2 export CUDA_HOME=$BASE_PATH/cuda-11.2
#make cuda11x CUDA_VERSION=112 make cuda11x CUDA_VERSION=112
#
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then if [ ! -f "./bitsandbytes/libbitsandbytes_cuda112.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist. # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2 echo "Compilation unsuccessul!" 1>&2
# exit 64 exit 64
#fi fi
#CUDA_VERSION=112 python -m build
# make clean
#make clean export CUDA_HOME=$BASE_PATH/cuda-11.3
#export CUDA_HOME=$BASE_PATH/cuda-11.3 make cuda11x CUDA_VERSION=113
#make cuda11x CUDA_VERSION=113
# if [ ! -f "./bitsandbytes/libbitsandbytes_cuda113.so" ]; then
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then # Control will enter here if $DIRECTORY doesn't exist.
# # Control will enter here if $DIRECTORY doesn't exist. echo "Compilation unsuccessul!" 1>&2
# echo "Compilation unsuccessul!" 1>&2 exit 64
# exit 64 fi
#fi
#CUDA_VERSION=113 python -m build make clean
# export CUDA_HOME=$BASE_PATH/cuda-11.4
#make clean make cuda11x CUDA_VERSION=114
#export CUDA_HOME=$BASE_PATH/cuda-11.4
#make cuda11x CUDA_VERSION=114 if [ ! -f "./bitsandbytes/libbitsandbytes_cuda114.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist.
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then echo "Compilation unsuccessul!" 1>&2
# # Control will enter here if $DIRECTORY doesn't exist. exit 64
# echo "Compilation unsuccessul!" 1>&2 fi
# exit 64
#fi make clean
#CUDA_VERSION=114 python -m build export CUDA_HOME=$BASE_PATH/cuda-11.5
# make cuda11x CUDA_VERSION=115
#make clean
#export CUDA_HOME=$BASE_PATH/cuda-11.5 if [ ! -f "./bitsandbytes/libbitsandbytes_cuda115.so" ]; then
#make cuda11x CUDA_VERSION=115 # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then exit 64
# # Control will enter here if $DIRECTORY doesn't exist. fi
# echo "Compilation unsuccessul!" 1>&2
# exit 64 make clean
#fi export CUDA_HOME=$BASE_PATH/cuda-11.6
#CUDA_VERSION=115 python -m build
# make cuda11x CUDA_VERSION=116
#make clean if [ ! -f "./bitsandbytes/libbitsandbytes_cuda116.so" ]; then
#export CUDA_HOME=$BASE_PATH/cuda-11.6 # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2
#make cuda11x CUDA_VERSION=116 exit 64
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then fi
# # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2 make clean
# exit 64 export CUDA_HOME=$BASE_PATH/cuda-11.7
#fi make cuda11x CUDA_VERSION=117
#CUDA_VERSION=116 python -m build
# if [ ! -f "./bitsandbytes/libbitsandbytes_cuda117.so" ]; then
#make clean # Control will enter here if $DIRECTORY doesn't exist.
#export CUDA_HOME=$BASE_PATH/cuda-11.7 echo "Compilation unsuccessul!" 1>&2
#make cuda11x CUDA_VERSION=117 exit 64
# fi
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2 make clean
# exit 64 export CUDA_HOME=$BASE_PATH/cuda-10.2
#fi make cuda10x_nomatmul CUDA_VERSION=102
#CUDA_VERSION=117 python -m build
# if [ ! -f "./bitsandbytes/libbitsandbytes_cuda102_nocublaslt.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist.
#make clean echo "Compilation unsuccessul!" 1>&2
#export CUDA_HOME=$BASE_PATH/cuda-10.2 exit 64
#make cuda10x_nomatmul CUDA_VERSION=102 fi
#
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist. make clean
# echo "Compilation unsuccessul!" 1>&2 export CUDA_HOME=$BASE_PATH/cuda-11.0
# exit 64 make cuda110_nomatmul CUDA_VERSION=110
#fi
#CUDA_VERSION=102-nomatmul python -m build if [ ! -f "./bitsandbytes/libbitsandbytes_cuda110_nocublaslt.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2
#make clean exit 64
#export CUDA_HOME=$BASE_PATH/cuda-11.0 fi
#make cuda110_nomatmul CUDA_VERSION=110
#
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then make clean
# # Control will enter here if $DIRECTORY doesn't exist. export CUDA_HOME=$BASE_PATH/cuda-11.1
# echo "Compilation unsuccessul!" 1>&2 make cuda11x_nomatmul CUDA_VERSION=111
# exit 64
#fi if [ ! -f "./bitsandbytes/libbitsandbytes_cuda111_nocublaslt.so" ]; then
#CUDA_VERSION=110-nomatmul python -m build # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2
# exit 64
#make clean fi
#export CUDA_HOME=$BASE_PATH/cuda-11.1
#make cuda11x_nomatmul CUDA_VERSION=111 make clean
# export CUDA_HOME=$BASE_PATH/cuda-11.2
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then make cuda11x_nomatmul CUDA_VERSION=112
# # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2 if [ ! -f "./bitsandbytes/libbitsandbytes_cuda112_nocublaslt.so" ]; then
# exit 64 # Control will enter here if $DIRECTORY doesn't exist.
#fi echo "Compilation unsuccessul!" 1>&2
#CUDA_VERSION=111-nomatmul python -m build exit 64
# fi
#make clean
#export CUDA_HOME=$BASE_PATH/cuda-11.2 make clean
#make cuda11x_nomatmul CUDA_VERSION=112 export CUDA_HOME=$BASE_PATH/cuda-11.3
# make cuda11x_nomatmul CUDA_VERSION=113
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist. if [ ! -f "./bitsandbytes/libbitsandbytes_cuda113_nocublaslt.so" ]; then
# echo "Compilation unsuccessul!" 1>&2 # Control will enter here if $DIRECTORY doesn't exist.
# exit 64 echo "Compilation unsuccessul!" 1>&2
#fi exit 64
#CUDA_VERSION=112-nomatmul python -m build fi
#
#make clean make clean
#export CUDA_HOME=$BASE_PATH/cuda-11.3 export CUDA_HOME=$BASE_PATH/cuda-11.4
#make cuda11x_nomatmul CUDA_VERSION=113 make cuda11x_nomatmul CUDA_VERSION=114
#
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then if [ ! -f "./bitsandbytes/libbitsandbytes_cuda114_nocublaslt.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist. # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2 echo "Compilation unsuccessul!" 1>&2
# exit 64 exit 64
#fi fi
#CUDA_VERSION=113-nomatmul python -m build
# make clean
#make clean export CUDA_HOME=$BASE_PATH/cuda-11.5
#export CUDA_HOME=$BASE_PATH/cuda-11.4 make cuda11x_nomatmul CUDA_VERSION=115
#make cuda11x_nomatmul CUDA_VERSION=114
# if [ ! -f "./bitsandbytes/libbitsandbytes_cuda115_nocublaslt.so" ]; then
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then # Control will enter here if $DIRECTORY doesn't exist.
# # Control will enter here if $DIRECTORY doesn't exist. echo "Compilation unsuccessul!" 1>&2
# echo "Compilation unsuccessul!" 1>&2 exit 64
# exit 64 fi
#fi
#CUDA_VERSION=114-nomatmul python -m build make clean
# export CUDA_HOME=$BASE_PATH/cuda-11.6
#make clean
#export CUDA_HOME=$BASE_PATH/cuda-11.5 make cuda11x_nomatmul CUDA_VERSION=116
#make cuda11x_nomatmul CUDA_VERSION=115 if [ ! -f "./bitsandbytes/libbitsandbytes_cuda116_nocublaslt.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist.
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then echo "Compilation unsuccessul!" 1>&2
# # Control will enter here if $DIRECTORY doesn't exist. exit 64
# echo "Compilation unsuccessul!" 1>&2 fi
# exit 64
#fi make clean
#CUDA_VERSION=115-nomatmul python -m build export CUDA_HOME=$BASE_PATH/cuda-11.7
# make cuda11x_nomatmul CUDA_VERSION=117
#make clean
#export CUDA_HOME=$BASE_PATH/cuda-11.6 if [ ! -f "./bitsandbytes/libbitsandbytes_cuda117_nocublaslt.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist.
#make cuda11x_nomatmul CUDA_VERSION=116 echo "Compilation unsuccessul!" 1>&2
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then exit 64
# # Control will enter here if $DIRECTORY doesn't exist. fi
# echo "Compilation unsuccessul!" 1>&2
# exit 64
#fi
#CUDA_VERSION=116-nomatmul python -m build
#
#make clean
#export CUDA_HOME=$BASE_PATH/cuda-11.7
#make cuda11x_nomatmul CUDA_VERSION=117
#
#if [ ! -f "./bitsandbytes/libbitsandbytes.so" ]; then
# # Control will enter here if $DIRECTORY doesn't exist.
# echo "Compilation unsuccessul!" 1>&2
# exit 64
#fi
#CUDA_VERSION=117-nomatmul python -m build
python -m build
python -m twine upload dist/* --verbose --repository testpypi python -m twine upload dist/* --verbose --repository testpypi
...@@ -3,28 +3,20 @@ ...@@ -3,28 +3,20 @@
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
import os import os
import glob
from setuptools import setup, find_packages from setuptools import setup, find_packages
import os libs = list(glob.glob('./bitsandbytes/libbitsandbytes*.so'))
libs = [os.path.basename(p) for p in libs]
def all_libs(directory): print('libs:', libs)
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
paths.append(os.path.join('..', path, filename))
return paths
def read(fname): def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read() return open(os.path.join(os.path.dirname(__file__), fname)).read()
version = os.getenv("CUDA_VERSION", "cpu")
prefix = '' if version == 'cpu' else 'cuda'
setup( setup(
name=f"bitsandbytes-{prefix}{version}", name=f"bitsandbytes",
version=f"0.30.2", version=f"0.31.0",
author="Tim Dettmers", author="Tim Dettmers",
author_email="dettmers@cs.washington.edu", author_email="dettmers@cs.washington.edu",
description="8-bit optimizers and matrix multiplication routines.", description="8-bit optimizers and matrix multiplication routines.",
...@@ -35,7 +27,7 @@ setup( ...@@ -35,7 +27,7 @@ setup(
entry_points={ entry_points={
"console_scripts": ["debug_cuda = bitsandbytes.debug_cli:cli"], "console_scripts": ["debug_cuda = bitsandbytes.debug_cli:cli"],
}, },
package_data={'': ['libbitsandbytes*.so']}, package_data={'': libs},
long_description=read('README.md'), long_description=read('README.md'),
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
classifiers=[ classifiers=[
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment