• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SpiNNakerManchester / SpiNNFrontEndCommon / 8174293153

06 Mar 2024 03:09PM UTC coverage: 47.973% (+0.005%) from 47.968%
8174293153

push

github

web-flow
Merge pull request #1161 from SpiNNakerManchester/cap_cores

vm core as min from version or cfg

2046 of 4793 branches covered (42.69%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

5482 of 10899 relevant lines covered (50.3%)

0.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.09
/spinn_front_end_common/interface/interface_functions/virtual_machine_generator.py
1
# Copyright (c) 2015 The University of Manchester
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#     https://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14

15
import logging
1✔
16
from spinn_utilities.config_holder import (
1✔
17
    get_config_int, get_config_str_or_none, is_config_none)
18
from spinn_utilities.log import FormatAdapter
1✔
19
from spinn_machine import json_machine, virtual_machine, Machine
1✔
20
logger = FormatAdapter(logging.getLogger(__name__))
1✔
21

22

23
def virtual_machine_generator() -> Machine:
1✔
24
    """
25
    Generates a virtual machine with given dimensions and configuration.
26

27
    :return: The virtual machine.
28
    :rtype: ~spinn_machine.Machine
29
    :raises Exception: If given bad arguments
30
    """
31
    height = get_config_int("Machine", "height")
×
32
    width = get_config_int("Machine", "width")
×
33

34
    json_path = get_config_str_or_none("Machine", "json_path")
×
35
    if json_path is None:
×
36
        assert width is not None and height is not None
×
NEW
37
        machine = virtual_machine(width=width, height=height, validate=True)
×
38
    else:
39
        if (height is not None or width is not None or
×
40
                not is_config_none("Machine", "down_chips") or
41
                not is_config_none("Machine", "down_cores") or
42
                not is_config_none("Machine", "down_links")):
43
            logger.warning("As json_path specified all other virtual "
×
44
                           "machine settings ignored.")
45
        machine = json_machine.machine_from_json(json_path)
×
46

47
    # Work out and add the SpiNNaker links and FPGA links
48
    machine.add_spinnaker_links()
×
49
    machine.add_fpga_links()
×
50

51
    logger.info("Created {}", machine.summary_string())
×
52

53
    return machine
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc