Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor methods without arguments into functions #685

Merged
merged 30 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1cbf330
Refactoring methods without arguments into functions.
mathisrichter May 8, 2023
e3ea8fd
Reverting unintentional change to tutorial.
mathisrichter May 10, 2023
b2e48d5
Added new set of functions by @tim-shea, refactored.
mathisrichter May 10, 2023
4d50c28
Fixed linter error: unused import.
mathisrichter May 11, 2023
84fab83
Fixed linter and security errors.
mathisrichter May 11, 2023
cf8ca15
Fixed linter errors.
mathisrichter May 11, 2023
c9ac3f1
Trying to make nosec work.
mathisrichter May 11, 2023
252cf9c
Moved nosec back; does not seem to make a difference.
mathisrichter May 11, 2023
9c10d15
Unit tests for some of the new functions in the slurm module.
mathisrichter May 12, 2023
b023a9e
Full unit tests for SLURM module.
mathisrichter May 13, 2023
a31bc93
Full unit tests for lava_loihi module.
mathisrichter May 13, 2023
e2ecf7d
Deactivated linter error.
mathisrichter May 13, 2023
0572a64
Trying different nosec variants.
mathisrichter May 13, 2023
1e673de
Trying different nosec variants.
mathisrichter May 13, 2023
57d4bed
Trying different nosec variants.
mathisrichter May 13, 2023
32e71b0
Redesigned the API for lava.utils.{slurm,loihi}.
mathisrichter May 18, 2023
65746e1
Another attempt at fixing linting.
mathisrichter May 18, 2023
3090ba9
Trying with noqa
mathisrichter May 18, 2023
0c75bb4
Fixed module error in test patch
mathisrichter May 18, 2023
b4b6f29
Renamed is_lava_loihi_installed to is_installed.
mathisrichter May 18, 2023
b212821
Fixed code duplication of patch decorators.
mathisrichter May 18, 2023
2836465
Added doc string to patch decorator.
mathisrichter May 20, 2023
e00f4cd
Merge branch 'main' of https://github.com/lava-nc/lava into loihi_sys…
mathisrichter May 20, 2023
dd8d859
Merge branch 'main' into loihi_system_refactor
mathisrichter May 21, 2023
49033e0
Merge branch 'main' into loihi_system_refactor
mathisrichter May 22, 2023
e74ba6c
Merge branch 'main' into loihi_system_refactor
mathisrichter May 25, 2023
5cd9770
Merge branch 'main' into loihi_system_refactor
mathisrichter May 26, 2023
abdcbd5
Finished loihi and slurm docstrings.
tim-shea Jul 18, 2023
30e6088
Merge branch 'main' into loihi_system_refactor
tim-shea Jul 18, 2023
ac66655
Merge pull request #1 from lava-nc/loihi_system_refactor
tim-shea Jul 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions src/lava/utils/system.py

This file was deleted.

51 changes: 51 additions & 0 deletions src/lava/utils/system/loihi2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
# See: https://spdx.org/licenses/

import os
from typing import Optional


preferred_partition: str = Optional[None]


def set_environ_settings(partition: Optional[str] = None) -> None:
"""Sets the os environment for execution on Loihi 2.
Parameters
----------
partition : str, optional
Loihi partition name, by default None.
"""
if 'SLURM' not in os.environ and 'NOSLURM' not in os.environ:
os.environ['SLURM'] = '1'
if 'LOIHI_GEN' not in os.environ:
os.environ['LOIHI_GEN'] = 'N3B3'
if 'PARTITION' not in os.environ and partition is not None:
os.environ['PARTITION'] = partition


def is_available() -> bool:
"""Checks if Loihi 2 compiler is available and sets the environment
variables.
Returns
-------
bool
Flag indicating whether Loihi 2 is available or not.
"""
try:
from lava.magma.compiler.subcompilers.nc.ncproc_compiler import \
CompilerOptions
CompilerOptions.verbose = True
except ModuleNotFoundError:
# Loihi 2 compiler is not available
return False
set_environ_settings(preferred_partition)
return True


@property
def partition() -> str:
"""Get the partition information."""
if 'PARTITION' in os.environ.keys():
return os.environ['PARTITION']
return 'Unspecified'