Parvulus / c_engine /Makefile
aasivas's picture
Upload folder using huggingface_hub
67c4f10 verified
Raw History Blame Contribute Delete
1.61 kB
CUDA_PATH ?= /usr/local/cuda
ifeq ($(wildcard $(CUDA_PATH)/bin/nvcc),)
CUDA_PATH := /usr
endif
NVCC := $(CUDA_PATH)/bin/nvcc
CXX := g++
NVCC_FLAGS := -O3 -c -Xcompiler -fPIC -std=c++17 -I. -I$(CUDA_PATH)/include
CXX_FLAGS := -O3 -fPIC -std=c++17 -I. -I$(CUDA_PATH)/include
LDFLAGS := -L$(CUDA_PATH)/lib64 -L. -lcublas -lcudart -Wl,-rpath,'$$ORIGIN' -Wl,-rpath,$(CUDA_PATH)/lib64
TARGET_LIB := libparvulus.so
TARGET_CLI := parvulus_runtime
TARGET_TEST := test_vision_encoder
.PHONY: all clean distclean test weights
all: $(TARGET_LIB) $(TARGET_CLI) $(TARGET_TEST)
weights:
@if [ ! -f parvulus_model_weights.bin ] || [ ! -f action_scale.bin ] || [ ! -f task_embeddings.bin ]; then \
python3 export_from_safetensors.py; \
fi
parvulus_engine.o: parvulus_engine.cu parvulus_engine.h vision_encoder.cu vision_encoder.cuh vision_encoder.h kernels.cuh
$(NVCC) $(NVCC_FLAGS) parvulus_engine.cu -o parvulus_engine.o
$(TARGET_LIB): parvulus_engine.o parvulus_c_api.cpp parvulus_c_api.h
$(CXX) -shared -fPIC parvulus_engine.o parvulus_c_api.cpp -o $(TARGET_LIB) $(CXX_FLAGS) $(LDFLAGS)
$(TARGET_CLI): parvulus_runtime_cli.cpp $(TARGET_LIB)
$(CXX) $(CXX_FLAGS) parvulus_runtime_cli.cpp -o $(TARGET_CLI) -lparvulus $(LDFLAGS)
$(TARGET_TEST): test_vision_encoder.cpp $(TARGET_LIB)
$(CXX) $(CXX_FLAGS) test_vision_encoder.cpp -o $(TARGET_TEST) -lparvulus $(LDFLAGS)
test: all weights
./$(TARGET_TEST)
./$(TARGET_CLI) --benchmark 20
clean:
rm -f parvulus_engine.o $(TARGET_LIB) $(TARGET_CLI) $(TARGET_TEST)
distclean: clean
rm -f parvulus_model_weights.bin action_scale.bin task_embeddings.bin *.onnx