Skip to content

Commit

Permalink
bench (#87)
Browse files Browse the repository at this point in the history
* cleaner make static library
* improving streamvbyte16 compilation options
* ignore static libraries
* zstd_local for svb16
---------

Co-authored-by: Sasha Jenner <[email protected]>
  • Loading branch information
sashajenner and Sasha Jenner authored Feb 12, 2024
1 parent a90d45c commit f3256b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# or uncomment the following line
#zstd=1

# to compile with local zstd headers
# run `make zstd_local=<dir>`
# zstd_local must be an absolute path

CC = cc
AR = ar
SVB = thirdparty/streamvbyte
Expand Down Expand Up @@ -51,8 +55,7 @@ slow5lib: $(SHAREDLIB) $(STATICLIB)
$(STATICLIB): $(OBJ) $(SVBLIB) $(SVB16LIB)
cp $(SVBLIB) $@
mkdir -p $(BUILD_DIR)/tmp
cp $(SVB16LIB) $(BUILD_DIR)/tmp/tmp.a
cd $(BUILD_DIR)/tmp && $(AR) x tmp.a && cd ../..
cd $(BUILD_DIR)/tmp && $(AR) x ../../$(SVB16LIB) && cd ../..
$(AR) rcs $@ $(OBJ) $(BUILD_DIR)/tmp/*.o
rm -rf $(BUILD_DIR)/tmp

Expand All @@ -63,7 +66,7 @@ $(SVBLIB):
make -C $(SVB) no_simd=$(no_simd) libstreamvbyte.a

$(SVB16LIB):
make -C $(SVB16) no_simd=$(no_simd) zstd=$(zstd) libstreamvbyte16.a
make -C $(SVB16) no_simd=$(no_simd) zstd=$(zstd) zstd_local=$(zstd_local) libstreamvbyte16.a

$(BUILD_DIR)/slow5.o: src/slow5.c src/slow5_extra.h src/slow5_idx.h src/slow5_misc.h src/klib/ksort.h $(SLOW5_H)
$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -fpic -o $@
Expand Down
22 changes: 16 additions & 6 deletions thirdparty/streamvbyte16/Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@
# compilation options
# NO_SIMD=1 for SSE SIMD
# ZSTD=1 for zstd
# no_simd=1 for no SSE SIMD
# zstd=1 for zstd

CC = cc
OBJ = streamvbyte16.o
STATICLIB = libstreamvbyte16.a
CFLAGS += -Wall -O3 -std=c99 -fpic -g
CFLAGS += -fPIC -std=c99 -O3 -Wall -Wextra -pedantic -Wshadow

PROC_AUTO:=$(shell uname -m)
PROCESSOR ?= $(PROC_AUTO)

ifeq ($(no_simd),1)
else
ifeq ($(PROCESSOR), aarch64)
CFLAGS += -DVBZ_ENABLE_SIMD
ifeq ($(PROCESSOR), aarch64)
# for 64-bit ARM processors
CFLAGS += -D__ARM_NEON__
else ifeq ($(PROCESSOR), armv7l)
# for 32-bit ARM processors
CFLAGS += -mfpu=neon
else ifeq ($(PROCESSOR), x86_64)
CFLAGS += -DVBZ_ENABLE_SIMD -msse4.1
CFLAGS += -msse4.1
endif
endif

ifeq ($(zstd),1)
CFLAGS += -DVBZ_USE_ZSTD
#LDFLAGS += -lzstd
endif
ifeq ($(zstd_local),)
else
CFLAGS += -DVBZ_USE_ZSTD
CPPFLAGS += -I $(zstd_local)
endif

.PHONY = clean

$(STATICLIB): $(OBJ)
$(AR) rcs $@ $^

streamvbyte16.o: streamvbyte16.c streamvbyte16.h svb16/*.h
$(CC) $(CFLAGS) $< -c -fpic -o $@
$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -fpic -o $@

clean:
rm -f $(OBJ) $(STATICLIB)

0 comments on commit f3256b6

Please sign in to comment.