diff --git a/Makefile b/Makefile deleted file mode 100644 index 74a6818c..00000000 --- a/Makefile +++ /dev/null @@ -1,147 +0,0 @@ -# Copyright 2018 Eli Lilly and Company -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -######################################################################## -IWPROGRAMMES ?= $(PWD) -UNAME ?= Linux-gcc-8.3.0 -#Linux-gcc-6.2.0 - -prefix = $(IWPROGRAMMES) -exec_prefix = $(prefix) - -LIB_ROOT_DIR = ${exec_prefix}/lib -INC_ROOT_DIR =${prefix}/include -BIN_ROOT_DIR = ${exec_prefix}/bin -libdir = $(LIB_ROOT_DIR)/$(UNAME) -includedir = $(INC_ROOT_DIR) -bindir = $(BIN_ROOT_DIR)/$(UNAME) - -CP=cp -p - -SUBDIRS := $(wildcard */.) - -.PHONY : $(SUBDIRS) -.PHONY : $(DO_X) -.PHONY: copy_include -.PHONY: library -.PHONY: copy_library -.PHONY: exe -.PHONY: copy_exe -.PHONY: clean -.PHONY: veryclean - - -DO_X = do-clean\ - do-veryclean\ - do-copy_include\ - do-library\ - do-copy_library\ - do-exe\ - do-copy_exe - -# Enter each directory to build -$(DO_X): - @target=`echo $@ | sed -e 's/^do-//'`; \ - if [ "$${target}" != "veryclean" ] ; \ - then \ - if [ ! -d ${libdir} ] ; \ - then \ - mkdir -p ${libdir} ; \ - fi ; \ - if [ ! -d ${bindir} ] ; \ - then \ - mkdir -p ${bindir} ; \ - fi ; \ - if [ ! -d ${includedir} ] ; \ - then \ - mkdir -p ${includedir} ; \ - fi ; \ - fi ; \ - for dir in $(SUBDIRS) ; \ - do \ - cd $${dir};\ - if [ -f ./Makefile ]; \ - then \ - if [ "$${target}" = "veryclean" ] ; \ - then \ - if [ -d ./$(UNAME) ] ; \ - then \ - rm -r ./$(UNAME) ; \ - fi ; \ - else \ - if [ ! -d ./$(UNAME) ] ; \ - then \ - mkdir ./$(UNAME) ; \ - fi ; \ - fi; \ - IWPROGRAMMES=$(IWPROGRAMMES) UNAME=$(UNAME) BUILD_DIR=$(UNAME) CXX=$(CXX) $(MAKE) -j 5 -f Makefile $${target} ; \ - fi; \ - cd ..;\ - done; \ - if [ "$${target}" = "veryclean" ] ; \ - then \ - if [ -d ${LIB_ROOT_DIR} ] ; \ - then \ - rm -r ${LIB_ROOT_DIR} ; \ - fi ; \ - if [ -d ${BIN_ROOT_DIR} ] ; \ - then \ - rm -r ${BIN_ROOT_DIR} ; \ - fi ; \ - if [ -d ${INC_ROOT_DIR} ] ; \ - then \ - rm -r ${INC_ROOT_DIR} ; \ - fi ; \ - fi; - -include: includedir copy_include_files - -includedir: - echo "Making ${includedir}" - if [ ! -d ${includedir} ] ; then mkdir ${includedir} ; fi - cp -p include/* $(includedir) - -libdir: $(libdir) - -bindir: $(bindir) - -copy_include: do-copy_include - -veryclean: do-veryclean - -clean: do-clean - -exe: do-exe - -copy_exe: do-copy_exe - -library: do-library - -copy_library: do-copy_library - - -build_docker: - docker build -f Dockerfile -t lillymolprivate . - -test_lillymol: - docker container exec lilly_mol bash -c "cd test/ && ./run_all_test.sh" - -start_s3: - docker-compose up -d - sleep 10 - echo 'run s3 commannd with: aws s3 --endpoint "http://localhost:4566" ' -stop_s3: - docker-compose down - - diff --git a/README.md b/README.md index 727abe76..cf79a6cf 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,9 @@ There is an install run target built into the BUILD files, and you must decide upon the directory to which that target should copy executables. See previous section. +While there is a script that should do the build for you, underneath these +are the commands being issued. Skip to the next section unless interested. + A typical build command might be (change the path for test_env) ``` @@ -212,6 +215,8 @@ version will be allowed to float via bazelisk. ## Targets to Test and Build +First run `build_third_party.sh` to ensure dependencies are built. + Actual tests, builds and installs can be handled by the `build_from_src.sh` script. The script `build_from_src.sh` will @@ -221,9 +226,9 @@ The script `build_from_src.sh` will 3. install executables into the `bin/Linux` directory (build_deps/install.bzl) ## cmake -There is `cmake` infrasture +There is `cmake` infrastructure included, but that may, or may not, work - within Lilly we have not -been able to make that work, usually as a result of conflicting protcol buffer +been able to make it work, usually as a result of conflicting protcol buffer versions on the system, but externally it often works, although it has not been tested recently. @@ -240,7 +245,11 @@ cd ./src # cp /tmp/WORKSPACE WORKSPACE # Examine /tmp/install.bzl # cp /tmp/install.bzl build_deps +./build_from_src.sh # Rebuild Molecule_Tools any time bazelisk --output_user_root=/node/scratch/$USER build --jobs=8 --enable_bzlmod --experimental_cc_shared_library -c opt --cxxopt=-DGIT_HASH=\"$(git rev-parse --short --verify HEAD)\" --cxxopt=-DTODAY=\"$(date +%Y-%b-%d)\" //Molecule_Tools:all --test_env=C3TK_DATA_PERSISTENT=/full/path/to/LillyMol/queries -``` \ No newline at end of file +``` +Note that because the date is included with cxxopt, this _will_ cause a daily +recompile. While this is hardly desirable, knowing when an executable was compiled +can be useful. \ No newline at end of file diff --git a/docs/python/LillyMolPython.md b/docs/python/LillyMolPython.md index c7f32bff..626d2383 100644 --- a/docs/python/LillyMolPython.md +++ b/docs/python/LillyMolPython.md @@ -54,7 +54,7 @@ This works because the LillyMol Molecule is a very lazy object. It never compute things like fragment membership, ring membership, aromaticity or canononical ordering unless requested. So if you remove an atom, or bond, it will destroy any information it has about those derived quantities. Only if requested will any -be computed. +be recomputed. This has many advantages. For example if a molecle is built from a smiles and then the only thing ever requested is the number of atoms, that will be @@ -593,13 +593,13 @@ m = MolFromSmiles('C(=N)(C1=C(O)C(=C(O)C=C1O)OC)CC1=CC=C(O)C=C1 CHEMBL503634') query.substructure_search(m) ``` The number of matches will be returned. In this case it will frequently be 2 since -the query will mactch two times in a benzene like ring. +the query will match two times in a benzene like ring. To get the matched atoms, as a List of List's, ``` matches = q.substructure_search_matches(m) ``` -and then the matches can be iterated. +and then the matches object (type SubstructureResults) can be iterated. For example if you wanted to place an isotope on each set of matched atoms that might look like ``` @@ -608,7 +608,7 @@ for match in query.substructure_search_matches(m): m.set_isotopes(match, 1) print(m) ``` -Omit the `remove_isotopes` call to accumulate the results. +Omit the `remove_isotopes` call to add the new isotopes to whatever might have already been there. On the other hand if you need to know which matched atom is which, that might look like ``` @@ -660,7 +660,7 @@ or ``` If the reaction is a simple form that has either no sidechains, or all sidechains have a single, already specified, reagent, then -the `in_place_transformations1 method can be used. +the `in_place_transformations` method can be used. ``` rxn.in_place_transformations(m) ``` diff --git a/src/Molecule_Tools/BUILD b/src/Molecule_Tools/BUILD index b190625f..b6d52469 100644 --- a/src/Molecule_Tools/BUILD +++ b/src/Molecule_Tools/BUILD @@ -353,23 +353,6 @@ cc_proto_library( ], ) -proto_library( - name = "tsubstructure_proto", - srcs = [ - "tsubstructure.proto", - ], - deps = [ - "//Molecule_Lib:substructure_proto", - ], -) - -cc_proto_library( - name = "tsubstructure_cc_proto", - deps = [ - "tsubstructure_proto", - ], -) - proto_library( name = "xlogp_proto", srcs = [ @@ -2852,22 +2835,22 @@ cc_library( # ], #) -cc_library( - name = "unique_molecules_api", - srcs = [ - "unique_molecules_api.cc", - ], - hdrs = [ - "unique_molecules_api.h", - ], - deps = [ - "//Molecule_Lib:iwmolecule", - "@com_google_absl//absl/container:btree", - ], - visibility = [ - "//visibility:public", - ], -) +# cc_library( +# name = "unique_molecules_api", +# srcs = [ +# "unique_molecules_api.cc", +# ], +# hdrs = [ +# "unique_molecules_api.h", +# ], +# deps = [ +# "//Molecule_Lib:iwmolecule", +# "@com_google_absl//absl/container:btree", +# ], +# visibility = [ +# "//visibility:public", +# ], +# ) cc_library( name = "xlogp_lib", diff --git a/src/Utilities/GFP_Tools/BUILD b/src/Utilities/GFP_Tools/BUILD index eaebcbff..4261b75e 100644 --- a/src/Utilities/GFP_Tools/BUILD +++ b/src/Utilities/GFP_Tools/BUILD @@ -315,23 +315,24 @@ cc_binary( ], ) -cc_binary( - name = "gfp_leader_threaded_mpi", - srcs = [ - "gfp_leader_threaded_mpi.cc", - ], - tags = [ - "mpi", - ], - deps = [ - "//Foundational/accumulator", - "//Foundational/cmdline:iwcmdline", - "//Foundational/data_source:iwstring_data_source", - "//Foundational/iwmisc", - "//Utilities/GFP_Tools:gfp", - "@mpich", - ], -) +# Enable if MPI is enabled in the current environment. +# cc_binary( +# name = "gfp_leader_threaded_mpi", +# srcs = [ +# "gfp_leader_threaded_mpi.cc", +# ], +# tags = [ +# "mpi", +# ], +# deps = [ +# "//Foundational/accumulator", +# "//Foundational/cmdline:iwcmdline", +# "//Foundational/data_source:iwstring_data_source", +# "//Foundational/iwmisc", +# "//Utilities/GFP_Tools:gfp", +# "@mpich", +# ], +# ) cc_binary( name = "gfp_mcs", diff --git a/src/build_from_src.sh b/src/build_from_src.sh index 617600da..9d958ded 100755 --- a/src/build_from_src.sh +++ b/src/build_from_src.sh @@ -17,7 +17,11 @@ jobs='8' # bazel will not work on an NFS mounted file system. So if you are on an NFS # file system, you must specify a value for --output_user_root that is # locally mounted. -bazel_options="--output_user_root=/node/scratch/ian" +# If your local file system is suitable for the bazel cache. +bazel_options="" +# If inside Lilly, some local scratch storage +# bazel_options="--output_user_root=/node/scratch/ian" + build_options="--cxxopt=-DGIT_HASH=\"$(git rev-parse --short --verify HEAD)\" --cxxopt=-DTODAY=\"$(date +%Y-%b-%d)\" --jobs=${jobs} -c opt --enable_bzlmod --experimental_cc_shared_library" echo ${common_options} diff --git a/src/build_third_party.sh b/src/build_third_party.sh index 0fa82f85..f9223565 100755 --- a/src/build_third_party.sh +++ b/src/build_third_party.sh @@ -78,17 +78,24 @@ must_build=0 # (cd googletest && cd build && make install) # fi -# if [[ ! -d 'protobuf' ]] ; then -# git clone https://github.com/protocolbuffers/protobuf -# fi -# if [[ ! -d "${third_party}/include/google/protobuf" ]] ; then -# (cd protobuf && git pull) -# (cd protobuf && git submodule update --init --recursive) -# (cd protobuf && ./autogen.sh) -# (cd protobuf && ./configure --prefix=${third_party} --enable-shared=no) -# (cd protobuf && make -j ${THREADS}) -# (cd protobuf && make install) -# fi +# Needed if building with cmake, and protoc is not installed +if [[ ! -d ${third_party}/bin ]] ; then + mkdir -p ${third_party}/bin +fi + +must_build=0 +if [[ ! -d 'protobuf' ]] ; then + git clone https://github.com/protocolbuffers/protobuf + must_build=1 +fi +if [[ ${must_build} -eq 1 || ! -d "${third_party}/include/google/protobuf" ]] ; then + (cd protobuf && git pull) + (cd protobuf && git submodule update --init --recursive) + # if bazel is used, the libraries don't get generated, not sure why... + (cd protobuf && cmake . -DCMAKE_CXX_STANDARD=14) + (cd protobuf && cmake --build .) + +fi # oneTBB now available via MODULE # must_build=0 @@ -160,16 +167,9 @@ fi # cilk?? # Not yet in the public release. -if [[ ! -s "https://github.com/intel/x86-simd-sort" ]] ; then +if [[ ! -d "x86-simd-sort" ]] ; then git clone 'https://github.com/intel/x86-simd-sort' fi - -# Make an attempt to generate an updated WORKSPACE file. -# First return to our starting point, which hopefully has WORKSPACE - -cd ${maybe_src} -echo "Back to ${PWD}" - # Figure out of WORKSPACE is where we can find it. if [[ -s 'WORKSPACE' ]] ; then workspace='WORKSPACE' @@ -184,7 +184,41 @@ fi # Oct 2022. Not implemented because it seems # that the existing conversion functions are faster. # That seems impossible. TODO:ianwatson investigate. -(cd ${third_party}/include && wget https://github.com/fastfloat/fast_float/releases/download/v3.4.0/fast_float.h) +set -x +if [[ ! -d "${third_party}/include" ]] ; then + mkdir -p "${third_party}/include" +fi +if [[ ! -s "${third_party}/include/fast_float.h" ]] ; then + (cd ${third_party}/include && wget https://github.com/fastfloat/fast_float/releases/download/v3.4.0/fast_float.h) +fi + +# If you do not want to install MPI dependent tools, omit this AND comment out the mpich +# section in WORKSPACE. Run the build with --build-tag_filters=-mpi which suppresses +# building of tools that depend on MPI. + +# Indeed this takes too long to build, and then fails because it needs some +# further system dependencies (Ubuntu 22). The best way to use mpi might be to install it on +# the system if you can. Only one tool depends on it. + +# must_build=0 +# mpi_version='4.1.2' +# if [[ ! -d ${third_party}/mpich-${mpi_version}/ ]] ; then +# (cd ${third_party} && wget https://www.mpich.org/static/downloads/4.1.2/mpich-${mpi_version}.tar.gz) +# (cd ${third_party} && tar zxvf mpich-${mpi_version}.tar.gz) +# must_build=1 +# fi + +# if [[ $must_build -eq 1 || ! -s ${third_party}/mpich/src/lib ]] ; then + (cd ${third_party}/mpich-${mpi_version}/ && ./configure --prefix=${third_party}) +# (cd ${third_party}/mpich-${mpi_version}/ && make) +# fi + +# Make an attempt to generate an updated WORKSPACE file. +# First return to our starting point, which hopefully has WORKSPACE + +cd ${maybe_src} +echo "Back to ${PWD}" + # OMG there seems to be a bug in sed, and this does not work! # If I change the third_party to third_partq it works. Amazing. @@ -202,6 +236,6 @@ echo "Please check ${tmpworkspace} for a possibly ready to use WORKSPACE file" > if [[ -s 'build_deps/install.bzl' ]] ; then tmpinstall='/tmp/install.bzl' bindir=$(echo ${PWD}/bin/Linux | sed -e 's/\//\\\//g') - sed -e "s/defult = \"..+\"/default =\"${bindir}\"/" build_deps/install.bzl > ${tmpinstall} + sed -e "s/default = \"..+\"/default =\"${bindir}\"/" build_deps/install.bzl > ${tmpinstall} echo "Please check ${tmpinstall} for a possibly ready to use build_deps/install.bzl file" >&2 fi