Skip to content

Commit

Permalink
Make ssu and faithpd use the shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
sfiligoi committed Jan 24, 2025
1 parent 897ce3e commit 817b7d7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 119 deletions.
28 changes: 11 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ PLATFORM := $(shell uname -s)
COMPILER := $(shell ($(CXX) -v 2>&1) | tr A-Z a-z )

ifeq ($(PLATFORM),Darwin)
all: api main install test_binaries
all: api install main install_main test_binaries

else

# Note: important that all_nv is after all_cpu_basic and all_nv_avx2 for tests to work
all: all_cpu_basic all_nv_avx2 all_nv all_combined test_binaries_nv

all_cpu_basic: api_cpu_basic main_cpu_basic install_cpu_basic
all_cpu_basic: api_cpu_basic install_cpu_basic

all_nv: api_nv main_nv install_nv
all_nv: api_nv install_nv

all_nv_avx2: api_nv_avx2 main_nv_avx2 install_nv_avx2
all_nv_avx2: api_nv_avx2 install_nv_avx2

all_combined: api_combined install_combined
all_combined: api_combined install_combined main install_main

endif

Expand Down Expand Up @@ -50,28 +50,22 @@ api_combined:
main:
cd src && make main

main_cpu_basic:
export BUILD_VARIANT=cpu_basic ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make main

main_nv:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make main

main_nv_avx2:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv_avx2 ; export BUILD_FULL_OPTIMIZATION=True ; cd src && make main
install_main:
cd src && make install

########### install

install:
cd src && make install
cd src && make install_lib

install_cpu_basic:
export BUILD_VARIANT=cpu_basic ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make install
export BUILD_VARIANT=cpu_basic ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make install_lib

install_nv:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make install
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make install_lib

install_nv_avx2:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv_avx2 ; export BUILD_FULL_OPTIMIZATION=True ; cd src && make install
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv_avx2 ; export BUILD_FULL_OPTIMIZATION=True ; cd src && make install_lib

install_combined:
cd combined && make install
Expand Down
4 changes: 1 addition & 3 deletions combined/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ libssu.so: libssu.o
$(CC) -shared -o libssu.so libssu.o -fPIC -ldl $(LDFLAGS)

install: libssu.so
rm -f ${PREFIX}/lib//libssu.so; cp libssu.so ${PREFIX}/lib/
rm -f ${PREFIX}/bin/ssu; cp ssu ${PREFIX}/bin/
rm -f ${PREFIX}/bin/faithpd; cp faithpd ${PREFIX}/bin/
rm -f ${PREFIX}/lib/libssu.so; cp libssu.so ${PREFIX}/lib/

clean:
rm -f libssu.o libssu.so
44 changes: 0 additions & 44 deletions combined/faithpd

This file was deleted.

47 changes: 0 additions & 47 deletions combined/ssu

This file was deleted.

19 changes: 11 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all main api test test_binaries install clean rapi_test
.PHONY: all main api test test_binaries install install_lib clean rapi_test

CXX := h5c++

Expand Down Expand Up @@ -138,7 +138,7 @@ endif

CPPFLAGS += -Wall -std=c++17 -pedantic -I. $(OPT) -fPIC -L$(PREFIX)/lib

all: api main install
all: api install_lib main install

main: $(SSU) $(FPD)

Expand All @@ -153,11 +153,11 @@ test_ska: test_ska.cpp tree.o tsv.o test_su.cpp biom.o biom_inmem.o biom_subsamp
test_api: test_api.cpp tree.o tsv.o test_su.cpp biom.o biom_inmem.o biom_subsampled.o unifrac.o skbio_alt.o api.o $(UNIFRAC_FILES)
$(CXX) $(CPPFLAGS) $(EXEFLAGS) test_api.cpp -o test_api tree.o biom.o biom_inmem.o biom_subsampled.o tsv.o $(UNIFRAC_FILES) unifrac.o skbio_alt.o api.o -llz4 $(BLASLIB) -lpthread

$(SSU): su.cpp tree.o biom.o biom_inmem.o biom_subsampled.o tsv.o unifrac.o cmd.o skbio_alt.o api.o $(UNIFRAC_FILES)
$(CXX) $(CPPFLAGS) $(EXEFLAGS) su.cpp -o $(SSU) tree.o biom.o biom_inmem.o biom_subsampled.o tsv.o $(UNIFRAC_FILES) unifrac.o cmd.o skbio_alt.o api.o -lhdf5_cpp -llz4 $(BLASLIB) -lpthread
$(SSU): su.cpp $(PREFIX)/lib/lib$(SSU).so
$(CXX) $(CPPFLAGS) $(EXEFLAGS) su.cpp -o $@ -l$(SSU)

$(FPD): faithpd.cpp tree.o biom.o biom_inmem.o biom_subsampled.o tsv.o unifrac.o cmd.o skbio_alt.o api.o $(UNIFRAC_FILES)
$(CXX) $(CPPFLAGS) $(EXEFLAGS) faithpd.cpp -o $(FPD) tree.o biom.o biom_inmem.o biom_subsampled.o tsv.o $(UNIFRAC_FILES) unifrac.o cmd.o skbio_alt.o api.o -lhdf5_cpp -llz4 $(BLASLIB) -lpthread
$(FPD): faithpd.cpp $(PREFIX)/lib/lib$(SSU).so
$(CXX) $(CPPFLAGS) $(EXEFLAGS) faithpd.cpp -o $@ -l$(SSU)

lib$(SSU).so: tree.o biom.o biom_inmem.o biom_subsampled.o tsv.o unifrac.o cmd.o skbio_alt.o api.o $(UNIFRAC_FILES)
$(CXX) $(LDDFLAGS) -o lib$(SSU).so tree.o biom.o biom_inmem.o biom_subsampled.o tsv.o $(UNIFRAC_FILES) unifrac.o cmd.o skbio_alt.o api.o -lc -llz4 $(BLASLIB) -L$(PREFIX)/lib -noshlib -lhdf5_cpp -lhdf5_hl_cpp -lhdf5_hl -lhdf5
Expand Down Expand Up @@ -195,8 +195,11 @@ test: test_binaries
./test_ska
./test_api

install: lib$(SSU).so $(SSU) $(FPD)
rm -f ${PREFIX}/lib//lib$(SSU).so; cp lib$(SSU).so ${PREFIX}/lib/
install_lib: lib$(SSU).so
rm -f ${PREFIX}/lib/lib$(SSU).so; cp lib$(SSU).so ${PREFIX}/lib/


install: $(SSU) $(FPD)
rm -f ${PREFIX}/bin/$(SSU); cp $(SSU) ${PREFIX}/bin/
rm -f ${PREFIX}/bin/$(FPD); cp $(FPD) ${PREFIX}/bin/
mkdir -p ${PREFIX}/include/unifrac
Expand Down

0 comments on commit 817b7d7

Please sign in to comment.