<commit_before>ifndef CUDA_PREFIX
  CUDA_PREFIX = /usr/local/cuda
endif
ifndef INSTALL_PREFIX
  INSTALL_PREFIX=/usr/local
endif


SRC_DIR = ./src

SRCS = $(SRC_DIR)/nnet/conv_bc01_matmul.cpp \
       $(SRC_DIR)/nnet/pool_b01.cpp \
       $(SRC_DIR)/nnet/cudnn.cpp

CUDA_SRCS = $(SRC_DIR)/elementwise.cu \
            $(SRC_DIR)/reduction.cu \
            $(SRC_DIR)/blas.cu \
            $(SRC_DIR)/random.cu \
            $(SRC_DIR)/image/img2win.cu \
            $(SRC_DIR)/nnet/one_hot.cu


INCLUDE_DIRS = ./include
INCLUDE_DIRS += $(CUDA_PREFIX)/include

ifneq ($(wildcard $(CUDA_PREFIX)/lib64),)
  # Use lib64 if it exists
  LIB_DIRS += $(CUDA_PREFIX)/lib64
endif
LIB_DIRS += $(CUDA_PREFIX)/lib
LIBS += cudart cublas cufft curand

ifeq ($(CUDNN_ENABLED), 1)
  C_FLAGS += -DCUDNN_ENABLED
  LIBS += cudnn
endif

CXX = g++
NVCC = $(CUDA_PREFIX)/bin/nvcc
BUILD_DIR = ./build
OBJS = $(SRCS:.cpp=.o) $(CUDA_SRCS:.cu=.o)
LIBCUDARRAY = libcudarray.so
LIBCUDARRAY_BUILD = $(BUILD_DIR)/$(LIBCUDARRAY)
LIBCUDARRAY_INSTALL = $(INSTALL_PREFIX)/lib/$(LIBCUDARRAY)

INCLUDES += $(foreach include_dir,$(INCLUDE_DIRS),-I$(include_dir))
C_FLAGS += -O3 -fPIC -Wall -Wfatal-errors
NVCC_FLAGS = -arch=sm_35 -O3 --compiler-options '$(C_FLAGS)' \
             --ftz=true --prec-div=false -prec-sqrt=false --fmad=true
LDFLAGS += $(foreach lib_dir,$(LIB_DIRS),-L$(lib_dir)) \
	       $(foreach lib,$(LIBS),-l$(lib))

<commit_msg>Build libcudarray for multiple CUDA architectures. Closes #12<commit_after>ifndef CUDA_PREFIX
  CUDA_PREFIX = /usr/local/cuda
endif
ifndef INSTALL_PREFIX
  INSTALL_PREFIX=/usr/local
endif


SRC_DIR = ./src

SRCS = $(SRC_DIR)/nnet/conv_bc01_matmul.cpp \
       $(SRC_DIR)/nnet/pool_b01.cpp \
       $(SRC_DIR)/nnet/cudnn.cpp

CUDA_SRCS = $(SRC_DIR)/elementwise.cu \
            $(SRC_DIR)/reduction.cu \
            $(SRC_DIR)/blas.cu \
            $(SRC_DIR)/random.cu \
            $(SRC_DIR)/image/img2win.cu \
            $(SRC_DIR)/nnet/one_hot.cu


INCLUDE_DIRS = ./include
INCLUDE_DIRS += $(CUDA_PREFIX)/include

ifneq ($(wildcard $(CUDA_PREFIX)/lib64),)
  # Use lib64 if it exists
  LIB_DIRS += $(CUDA_PREFIX)/lib64
endif
LIB_DIRS += $(CUDA_PREFIX)/lib
LIBS += cudart cublas cufft curand

ifeq ($(CUDNN_ENABLED), 1)
  C_FLAGS += -DCUDNN_ENABLED
  LIBS += cudnn
endif

ifndef CUDA_ARCH
  # By default, libcudarray is built for a range of different CUDA
  # architectures. You can speed up compilation time by selecting only the
  # architecture for your GPU.
  CUDA_ARCH = -gencode arch=compute_20,code=sm_20 \
              -gencode arch=compute_20,code=compute_20 \
              -gencode arch=compute_30,code=sm_30 \
              -gencode arch=compute_30,code=compute_30 \
              -gencode arch=compute_35,code=sm_35 \
              -gencode arch=compute_35,code=compute_35
endif

CXX = g++
NVCC = $(CUDA_PREFIX)/bin/nvcc
BUILD_DIR = ./build
OBJS = $(SRCS:.cpp=.o) $(CUDA_SRCS:.cu=.o)
LIBCUDARRAY = libcudarray.so
LIBCUDARRAY_BUILD = $(BUILD_DIR)/$(LIBCUDARRAY)
LIBCUDARRAY_INSTALL = $(INSTALL_PREFIX)/lib/$(LIBCUDARRAY)

INCLUDES += $(foreach include_dir,$(INCLUDE_DIRS),-I$(include_dir))
C_FLAGS += -O3 -fPIC -Wall -Wfatal-errors
NVCC_FLAGS = $(CUDA_ARCH) -O3 --compiler-options '$(C_FLAGS)' \
             --ftz=true --prec-div=false -prec-sqrt=false --fmad=true
LDFLAGS += $(foreach lib_dir,$(LIB_DIRS),-L$(lib_dir)) \
	       $(foreach lib,$(LIBS),-l$(lib))


{'fraction_non_alphanumeric': 0.15137208616110948, 'fraction_numerical': 0.016524048391856005, 'mean_word_length': 3.296577946768061, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4449050', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1286, 'n_words': 227}