Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
candiceT233 committed Jan 24, 2024
2 parents f4e8771 + 090d75a commit 6d70bad
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
4 changes: 4 additions & 0 deletions jarvis_util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@
from jarvis_util.serialize.pickle import *
from jarvis_util.serialize.json_file import *
from jarvis_util.shell.filesystem import *
from jarvis_util.shell.pbs_exec import *
from jarvis_util.shell.exec import *
from jarvis_util.shell.exec_info import *
from jarvis_util.shell.ssh_exec import *
from jarvis_util.shell.pssh_exec import *
from jarvis_util.shell.process import *
from jarvis_util.shell.pscp import *
from jarvis_util.shell.slurm_exec import *
from jarvis_util.shell.scp import *
from jarvis_util.shell.compile import *
from jarvis_util.shell.mpi_exec import *
from jarvis_util.shell.local_exec import *
from jarvis_util.introspect.system_info import *
from jarvis_util.introspect.monitor import *
from jarvis_util.jutil_manager import *
2 changes: 2 additions & 0 deletions jarvis_util/introspect/monitor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from jarvis_util.shell.exec import Exec

class Callgrind(Exec):
def __init__(self, cmd, exec_info=None):
super().__init__(f'valgrind --tool=callgrind {cmd}')
Expand Down
45 changes: 45 additions & 0 deletions jarvis_util/shell/compile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

from .exec import Exec
from .local_exec import LocalExecInfo
from .filesystem import Mkdir

class Cmake(Exec):
def __init__(self, root_dir, out_dir, opts=None, exec_info=None):
"""
Run cmake
:param root_dir: Where the root of the cmake project is
:param out_dir: Where to output build data
:param opts: A dict mapping cmake keys to values
:param exec_info: The execution info
"""
if exec_info is None:
exec_info = LocalExecInfo()
self.opts = opts
self.root_dir = root_dir
self.out_dir = out_dir
Mkdir(out_dir)
self.cmd = [f'cmake {root_dir}']
if opts is not None:
for key, val in opts.items():
if isinstance(val, bool):
if val:
self.cmd.append(f'-D{key}=ON')
else:
self.cmd.append(f'-D{key}=OFF')
else:
self.cmd.append(f'-D{key}={val}')
self.cmd = ' '.join(self.cmd)
super().__init__(self.cmd, exec_info.mod(cwd=self.out_dir))

class Make(Exec):
def __init__(selfs, build_dir, nthreads=8, install=False,
exec_info=None):
if exec_info is None:
exec_info = LocalExecInfo()
if install:
cmd = f'make -j{nthreads} install'
else:
cmd = f'make -j{nthreads}'
super().__init__(cmd,
exec_info.mod(cwd=build_dir))
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pyyaml
pylint==2.15.0
#pylint==2.15.0
#coverage==5.5
#coverage-lcov==0.2.4
pytest==6.2.5
#pytest==6.2.5
tabulate
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
packages=setuptools.find_packages(),
install_requires=[
'pyyaml',
'pylint==2.15.0',
# 'pylint==2.15.0',
# 'coverage==5.5',
# 'coverage-lcov==0.2.4',
'pytest==6.2.5',
# 'pytest==6.2.5',
'tabulate'
],
classifiers=[
Expand Down

0 comments on commit 6d70bad

Please sign in to comment.