diff --git a/ann_benchmarks/main.py b/ann_benchmarks/main.py index dc34bf8..c4078ec 100644 --- a/ann_benchmarks/main.py +++ b/ann_benchmarks/main.py @@ -214,7 +214,7 @@ def _test(df): try: if args.local: - run(definition, args.dataset, args.count, args.runs, args.batch, args.rq, args.radius) + run(definition, args.dataset, args.count, args.runs, args.batch, args.rq) elif args.docker: run_docker(definition, args.dataset, args.count, args.runs, args.timeout, args.batch, args.rq, args.radius) else:# by default run Singularity diff --git a/ann_benchmarks/runner.py b/ann_benchmarks/runner.py index 1d3c3a4..7f17dfc 100644 --- a/ann_benchmarks/runner.py +++ b/ann_benchmarks/runner.py @@ -34,8 +34,8 @@ def run_individual_query(algoname, algo, X_train, X_test, distance, count, run_c n_items_processed = [0] # a bit dumb but can't be a scalar since of Python's scoping rules def single_query(v): - # special code for the Risc and DivideSkip - if "Risc" in algoname or 'DivideSkip' in algoname: + # special code for the Risc, DivideSkip, and Chemfp + if algoname in ['Risc', 'DivideSkip', 'Chemfp']: algo.pre_query(v, count) start = time.time() @@ -45,8 +45,8 @@ def single_query(v): candidates = algo.query(v, count) total = (time.time() - start) - # special code for the Risc and DivideSkip - if "Risc" in algoname or 'DivideSkip' in algoname: + # special code for the Risc, DivideSkip, and Chemfp + if algoname in ['Risc', 'DivideSkip', 'Chemfp']: candidates = algo.post_query() if issparse(X_train): @@ -123,12 +123,15 @@ def run(definition, dataset, count, run_count, batch, rq): print('got %d queries' % len(X_test)) try: - # special code for the Risc and DivideSkip print(X_train.shape) - if 'Risc' in definition.algorithm or 'DivideSkip' in definition.algorithm: + # special code for Risc and DivideSkip + if definition.algorithm in ['Risc', 'DivideSkip']: X_train = numpy.concatenate((X_train, [numpy.ones(X_train.shape[1], dtype=numpy.bool)]), axis=0) print(X_train.shape) algo.pre_fit(X_train) + # special code for Chemfp + if definition.algorithm in 'Chemfp': + algo.pre_fit(X_train) t0 = time.time() index_size_before = algo.get_index_size("self") @@ -298,11 +301,9 @@ def run_singularity(definition, dataset, count, runs, timeout, batch, rq, radius strCmd = ' '.join(["'" + k + "'" for k in cmd]) print('String of command', strCmd) - subprocess.check_call('singularity exec %s/%s.sif python3 run_algorithm.py %s' %(sif_dir, definition.singularity_tag, strCmd), shell=True) - #subprocess.check_call('singularity exec ../../singularity/ann-bench-nmslib3.sif python3 run_algorithm.py %s' %(strCmd), shell=True) - #subprocess.check_call('singularity exec ../singularity/ann-bench-pynndescent.sif python3 run_algorithm.py %s' %(strCmd), shell=True) - #subprocess.check_call('singularity exec ../singularity/ann-bench-datasketch.sif python3 run_algorithm.py %s' %(strCmd), shell=True) - #subprocess.check_call('singularity exec ../singularity/ann-bench-sklearn.sif python3 run_algorithm.py %s' %(strCmd), shell=True) - #subprocess.check_call('singularity exec ../singularity/ann-bench-risc.sif python3 run_algorithm.py %s' %(strCmd), shell=True) - #subprocess.check_call('singularity exec ../singularity/ann-bench-ngt.sif python3 run_algorithm.py %s' %(strCmd), shell=True) + # Chemfp uses Python2 while others use Python3 + if definition.algorithm in 'Chemfp': + subprocess.check_call('singularity exec %s/%s.sif python run_algorithm.py %s' %(sif_dir, definition.singularity_tag, strCmd), shell=True) + else: + subprocess.check_call('singularity exec %s/%s.sif python3 run_algorithm.py %s' %(sif_dir, definition.singularity_tag, strCmd), shell=True)