jgans / thermonucleotideBLAST

Searching DNA/RNA sequence databases with PCR and/or probe queries
Other
16 stars 10 forks source link

Error when compiling without mpic++ #9

Closed SRooke closed 4 months ago

SRooke commented 5 months ago

When I try to compile using OpenMP instead of mpic++, I am getting an error from make:

gcc  -O3 -Wall -fopenmp -std=c++14  -DUSE_BLAST_DB -I.  -I/mnt/Storage/genomics/tools/ncbi-blast-2.12.0+-src/c++/include -c tntblast_local.cpp
tntblast_local.cpp: In function ‘int local_main(int, char**)’:
tntblast_local.cpp:783:17: error: ‘synchronize_keys’ was not declared in this scope
   index_table = synchronize_keys(str_table);
                 ^~~~~~~~~~~~~~~~
Makefile:65: recipe for target 'tntblast_local.o' failed
make: *** [tntblast_local.o] Error 1

I have traced this back to the definition of synchronize_keys being nested under an a conditional in tntblast_local.h, and tntblast_utils.cpp.

The instructions didn't mention removing objs from OBJs in the makefile, so I am wondering if I have set it up incorrectly in some way for it to be calling functions which appear to require -USE_MPI.

I have included my Makefile here:

> OBJS` = tntblast.o degenerate_na.o primer.o input.o nuc_cruc_anchor.o \
> 
>   nuc_cruc.o nuc_cruc_output.o nuc_cruc_santa_lucia.o bind_oligo.o \
>   amplicon_search.o probe_search.o padlock_search.o tntblast_master.o \
>   tntblast_worker.o tntblast_util.o options.o tntblast_local.o bitmask.o \
>   sequence_data.o sequence_data_annot.o annotation.o annotation_embl.o \
>   annotation_gbk.o annotation_util.o \
>   sequence_data_fastx.o tntblast_timer.o mpi_util.o
> 
> #CC = mpic++
> CC = gcc
> 
> PROFILE = #-g -pg
> 
> # If you're using gcc and would like to enable single computer multi-threading,
> # uncomment this OPENMP variable
> OPENMP = -fopenmp
> 
> # If you're using the clang C++ compiler on OS X and would like to enable single 
> # computer multi-threading, please uncomment this CLANG_OPENMP variable.
> # - Before attemping to compile tntblast, please read the very helpfull
> #         blog post at https://iscinumpy.gitlab.io/post/omp-on-high-sierra/
> #     - Follow the process documented in the above blog post to install the required
> #     OpenMP libraries that are needed by the Clang compiler.
> # - When running tntblast on OS X, please note that DYLD_LIBRARY_PATH must be set 
> #     to the directory that contains the OpenMP libomp.dylib file, i.e., :
> # 
> #     export DYLD_LIBRARY_PATH=/$HOME/llvm-project/build-openmp/runtime/src
> # With the introduction of ncbi-blast-2.11, we must specify -std=c++14 (as opposed to the
> # -std=c++11 that was used for ncbi-blast-2.10
> 
> #CLANG_OPENMP = -Xpreprocessor -fopenmp
> 
> # Define USE_MPI to enable MPI
> FLAGS = $(PROFILE) -O3 -Wall $(OPENMP) -std=c++14
> 
> INC = -I. 
> LIBS = -lm -lz
> 
> ifdef CLANG_OPENMP
>   OPENMP = $(CLANG_OPENMP)
>   INC += -I$(HOME)/llvm-project/build-openmp/runtime/src
>   LIBS += -L$(HOME)/llvm-project/build-openmp/runtime/src -lomp
> endif
> 
> # The BLAST_DIR variable should only be defined if you wish to be able to
> # read NCBI BLAST-formatted database files. This functionality is optional, and
> # can be disabled by commenting out the BLAST_DIR variable by adding the '#' symbol
> # to the start of the line below (i.e. "#BLAST_DIR").
> BLAST_DIR = /mnt/Storage/genomics/tools/ncbi-blast-2.12.0+-src/c++
> 
> ifdef BLAST_DIR
> 
>   FLAGS += -DUSE_BLAST_DB
> 
>   # Compile with the NCBI C++ toolkit (tntblast will be able to read BLAST-formatted databases)
>   INC += -I$(BLAST_DIR)/include
>   LIBS += -L $(BLAST_DIR)/lib \
>       -lseqdb -lxobjmgr -lblastdb -lgeneral -lgenome_collection -llmdb \
>       -lseq -lpub -lmedline -lseqcode -lseqset -lsequtil -lxser -lxutil -lxncbi -lsubmit -lbiblio -ldl
> 
> endif
> 
> .SUFFIXES : .o .cpp .c
> .cpp.o:   
>   $(CC) $(FLAGS) $(INC) -c $<
> 
> all: tntblast
> 
> tntblast : $(OBJS)
>   $(CC) $(PROFILE) -o tntblast $(OBJS) $(LIBS) $(OPENMP)
> 
> clean:
>   -rm -f *.o
> 

/

Thanks!

jgans commented 5 months ago

Hi Stefan,

Thanks for pointing out this problem! I have updated the code in main branch to enable the code correctly compile with and without MPI. Please let me know if you run into any issues with the current code.

SRooke commented 5 months ago

Amazingly quick response, and I can confirm it works entirely as expected now!

Thankyou!