Skip to content
Snippets Groups Projects
Commit 282e6276 authored by Michele Alberti's avatar Michele Alberti
Browse files

[nnenum] Better detection that actually fails when nnenum is not found.

Also provide more general python script that detects the existance of a python
module. The script takes two arguments: module name as first argument, and the
output string (typically, a version) that CAISAR uses for detection as second argument.
parent 4131bf84
No related branches found
No related tags found
No related merge requests found
......@@ -2,5 +2,6 @@
(package caisar)
(section bin)
(files
(findmodule.py as findmodule.py)
(nnenum.sh as nnenum.sh))
)
#!/usr/bin/env python3
###########################################################################
# #
# This file is part of CAISAR. #
# #
# Copyright (C) 2022 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
# You can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file licenses/LGPLv2.1). #
# #
###########################################################################
import sys
import importlib
module_name = str(sys.argv[1])
output = str(sys.argv[2])
spec = importlib.util.find_spec(module_name)
if spec is not None:
print(output)
exit(0)
else:
exit(1)
......@@ -22,7 +22,7 @@
###########################################################################
if [ "$1" = "--version" ]; then
echo dummy
findmodule.py "nnenum" "dummy"
else
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 -m nnenum.nnenum "$@"
fi
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment