How to use the aenum.AutoNumberEnum function in aenum

To help you get started, we’ve selected a few aenum examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spcl / dace / dace / codegen / targets / target.py View on Github external
in the code.
        """
        raise NotImplementedError('Abstract class')


class IllegalCopy(TargetCodeGenerator):
    """ A code generator that is triggered when invalid copies are specified
        by the SDFG. Only raises an exception on failure. """
    def copy_memory(self, sdfg, dfg, state_id, src_node, dst_node, edge,
                    function_stream, callsite_stream):
        raise TypeError('Illegal copy! (from ' + str(src_node) + ' to ' +
                        str(dst_node) + ')')


@extensible_enum
class DefinedType(aenum.AutoNumberEnum):
    """ Data types for `DefinedMemlets`.
        @see: DefinedMemlets
    """
    Pointer = ()
    Scalar = ()
    ArrayView = ()
    Stream = ()
    StreamArray = ()
    StreamView = ()
    FPGA_ShiftRegister = ()


class DefinedMemlets:
    """ Keeps track of the type of defined memlets to ensure that they are
        referenced correctly in nested scopes and SDFGs. """
    def __init__(self):
github spcl / dace / dace / dtypes.py View on Github external
""" A module that contains various DaCe type definitions. """
from __future__ import print_function
import ctypes
import aenum
import inspect
import numpy
import re
from functools import wraps
from typing import Any
from dace.config import Config
from dace.registry import extensible_enum


@extensible_enum
class StorageType(aenum.AutoNumberEnum):
    """ Available data storage types in the SDFG. """

    Default = ()  # Scope-default storage location
    Register = ()  # Local data on registers, stack, or equivalent memory
    CPU_Pinned = ()  # Host memory that can be DMA-accessed from accelerators
    CPU_Heap = ()  # Host memory allocated on heap
    CPU_ThreadLocal = ()  # Thread-local host memory
    GPU_Global = ()  # Global memory
    GPU_Shared = ()  # Shared memory
    FPGA_Global = ()  # Off-chip global memory (DRAM)
    FPGA_Local = ()  # On-chip memory (bulk storage)
    FPGA_Registers = ()  # On-chip memory (fully partitioned registers)
    FPGA_ShiftRegister = ()  # Only accessible at constant indices


@extensible_enum
github spcl / dace / dace / dtypes.py View on Github external
Default = ()  # Scope-default storage location
    Register = ()  # Local data on registers, stack, or equivalent memory
    CPU_Pinned = ()  # Host memory that can be DMA-accessed from accelerators
    CPU_Heap = ()  # Host memory allocated on heap
    CPU_ThreadLocal = ()  # Thread-local host memory
    GPU_Global = ()  # Global memory
    GPU_Shared = ()  # Shared memory
    FPGA_Global = ()  # Off-chip global memory (DRAM)
    FPGA_Local = ()  # On-chip memory (bulk storage)
    FPGA_Registers = ()  # On-chip memory (fully partitioned registers)
    FPGA_ShiftRegister = ()  # Only accessible at constant indices


@extensible_enum
class ScheduleType(aenum.AutoNumberEnum):
    """ Available map schedule types in the SDFG. """
    # TODO: Address different targets w.r.t. sequential
    # TODO: Add per-type properties for scope nodes. Consider TargetType enum
    #       and a MapScheduler class

    Default = ()  # Scope-default parallel schedule
    Sequential = ()  # Sequential code (single-thread)
    MPI = ()  # MPI processes
    CPU_Multicore = ()  # OpenMP
    GPU_Device = ()  # Kernel
    GPU_ThreadBlock = ()  # Thread-block code
    GPU_ThreadBlock_Dynamic = ()  # Allows rescheduling work within a block
    GPU_Persistent = ()
    FPGA_Device = ()
github spcl / dace / dace / dtypes.py View on Github external
GPU_ThreadBlock = ()  # Thread-block code
    GPU_ThreadBlock_Dynamic = ()  # Allows rescheduling work within a block
    GPU_Persistent = ()
    FPGA_Device = ()


# A subset of GPU schedule types
GPU_SCHEDULES = [
    ScheduleType.GPU_Device,
    ScheduleType.GPU_ThreadBlock,
    ScheduleType.GPU_ThreadBlock_Dynamic,
    ScheduleType.GPU_Persistent,
]


class ReductionType(aenum.AutoNumberEnum):
    """ Reduction types natively supported by the SDFG compiler. """

    Custom = ()  # Defined by an arbitrary lambda function
    Min = ()  # Minimum value
    Max = ()  # Maximum value
    Sum = ()  # Sum
    Product = ()  # Product
    Logical_And = ()  # Logical AND (&&)
    Bitwise_And = ()  # Bitwise AND (&)
    Logical_Or = ()  # Logical OR (||)
    Bitwise_Or = ()  # Bitwise OR (|)
    Logical_Xor = ()  # Logical XOR (!=)
    Bitwise_Xor = ()  # Bitwise XOR (^)
    Min_Location = ()  # Minimum value and its location
    Max_Location = ()  # Maximum value and its location
    Exchange = ()  # Set new value, return old value
github spcl / dace / dace / dtypes.py View on Github external
Bitwise_And = ()  # Bitwise AND (&)
    Logical_Or = ()  # Logical OR (||)
    Bitwise_Or = ()  # Bitwise OR (|)
    Logical_Xor = ()  # Logical XOR (!=)
    Bitwise_Xor = ()  # Bitwise XOR (^)
    Min_Location = ()  # Minimum value and its location
    Max_Location = ()  # Maximum value and its location
    Exchange = ()  # Set new value, return old value

    # Only supported in OpenMP
    Sub = ()  # Subtraction
    Div = ()  # Division


@extensible_enum
class AllocationLifetime(aenum.AutoNumberEnum):
    """ Options for allocation span (when to allocate/deallocate) of data. """

    Scope = ()  # Allocated/Deallocated on innermost scope start/end
    State = ()  # Allocated throughout the containing state
    SDFG = ()  # Allocated throughout the innermost SDFG (possibly nested)
    Global = ()  # Allocated throughout the entire program (outer SDFG)
    Persistent = ()  # Allocated throughout multiple invocations (init/exit)


@extensible_enum
class Language(aenum.AutoNumberEnum):
    """ Available programming languages for SDFG tasklets. """

    Python = ()
    CPP = ()
github spcl / dace / dace / dtypes.py View on Github external
Div = ()  # Division


@extensible_enum
class AllocationLifetime(aenum.AutoNumberEnum):
    """ Options for allocation span (when to allocate/deallocate) of data. """

    Scope = ()  # Allocated/Deallocated on innermost scope start/end
    State = ()  # Allocated throughout the containing state
    SDFG = ()  # Allocated throughout the innermost SDFG (possibly nested)
    Global = ()  # Allocated throughout the entire program (outer SDFG)
    Persistent = ()  # Allocated throughout multiple invocations (init/exit)


@extensible_enum
class Language(aenum.AutoNumberEnum):
    """ Available programming languages for SDFG tasklets. """

    Python = ()
    CPP = ()


class AccessType(aenum.AutoNumberEnum):
    """ Types of access to an `AccessNode`. """

    ReadOnly = ()
    WriteOnly = ()
    ReadWrite = ()


@extensible_enum
class InstrumentationType(aenum.AutoNumberEnum):
github bunq / sdk_python / bunq / sdk / context / api_environment_type.py View on Github external
import aenum


class ApiEnvironmentType(aenum.AutoNumberEnum):
    """
    :type PRODUCTION: ApiEnvironmentType
    :type SANDBOX: ApiEnvironmentType
    :type uri_base: str
    """

    PRODUCTION = 'https://api.bunq.com/v1/'
    SANDBOX = 'https://public-api.sandbox.bunq.com/v1/'

    def __init__(self, uri_base: str) -> None:
        self._uri_base = uri_base

    @property
    def uri_base(self) -> str:
        return self._uri_base
github spcl / dace / dace / dtypes.py View on Github external
Scope = ()  # Allocated/Deallocated on innermost scope start/end
    State = ()  # Allocated throughout the containing state
    SDFG = ()  # Allocated throughout the innermost SDFG (possibly nested)
    Global = ()  # Allocated throughout the entire program (outer SDFG)
    Persistent = ()  # Allocated throughout multiple invocations (init/exit)


@extensible_enum
class Language(aenum.AutoNumberEnum):
    """ Available programming languages for SDFG tasklets. """

    Python = ()
    CPP = ()


class AccessType(aenum.AutoNumberEnum):
    """ Types of access to an `AccessNode`. """

    ReadOnly = ()
    WriteOnly = ()
    ReadWrite = ()


@extensible_enum
class InstrumentationType(aenum.AutoNumberEnum):
    """ Types of instrumentation providers.
        @note: Might be determined automatically in future versions.
    """

    No_Instrumentation = ()
    Timer = ()
    PAPI_Counters = ()
github spcl / dace / dace / dtypes.py View on Github external
""" Available programming languages for SDFG tasklets. """

    Python = ()
    CPP = ()


class AccessType(aenum.AutoNumberEnum):
    """ Types of access to an `AccessNode`. """

    ReadOnly = ()
    WriteOnly = ()
    ReadWrite = ()


@extensible_enum
class InstrumentationType(aenum.AutoNumberEnum):
    """ Types of instrumentation providers.
        @note: Might be determined automatically in future versions.
    """

    No_Instrumentation = ()
    Timer = ()
    PAPI_Counters = ()
    CUDA_Events = ()


# Maps from ScheduleType to default StorageType
SCOPEDEFAULT_STORAGE = {
    None: StorageType.CPU_Heap,
    ScheduleType.Sequential: StorageType.Register,
    ScheduleType.MPI: StorageType.CPU_Heap,
    ScheduleType.CPU_Multicore: StorageType.Register,

aenum

Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

73 / 100
Full package analysis