How to use the pyccel.parser.syntax.openacc.AccBasic function in pyccel

To help you get started, we’ve selected a few pyccel 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 pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
    @property
    def expr(self):
        if DEBUG:
            print("> AccAtomicConstruct: expr")

        txt = 'atomic'
        for clause in self.clauses:
            if isinstance(clause, AccAtomicClause):
                txt = '{0} {1}'.format(txt, clause.expr)
            else:
                raise TypeError('Unexpected clause of type {0}'.format(type(clause)))

        return AnnotatedComment('acc', txt)

class AccDeclareDirective(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.clauses = kwargs.pop('clauses')

        super(AccDeclareDirective, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccDeclareDirective: expr")

        _valid_clauses = (AccCopy,
                          AccCopyin,
                          AccCopyout,
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
AccPresent,
                          AccDevicePtr,
                          AccPrivate,
                          AccFirstPrivate,
                          AccDefault)

        txt = 'parallel'
        for clause in self.clauses:
            if isinstance(clause, _valid_clauses):
                txt = '{0} {1}'.format(txt, clause.expr)
            else:
                raise TypeError('Unexpected clause of type {0}'.format(type(clause)))

        return AnnotatedComment('acc', txt)

class AccKernelsConstruct(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.clauses = kwargs.pop('clauses')

        super(AccKernelsConstruct, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccKernelsConstruct: expr")

        _valid_clauses = (AccAsync,
                          AccWait,
                          AccNumGangs,
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
AccVector,
                          AccSeq,
                          AccBind,
                          AccDeviceType,
                          AccNoHost)

        txt = 'routine'
        for clause in self.clauses:
            if isinstance(clause, _valid_clauses):
                txt = '{0} {1}'.format(txt, clause.expr)
            else:
                raise TypeError('Unexpected clause of type {0}'.format(type(clause)))

        return AnnotatedComment('acc', txt)

class AccWaitDirective(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.clauses = kwargs.pop('clauses')

        super(AccWaitDirective, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccWaitDirective: expr")

        txt = 'wait'
        for clause in self.clauses:
            if isinstance(clause, AccAsync):
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
"""
        self.arg = kwargs.pop('arg')

        super(AccBind, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccBind: expr")

        # TODO check if variable exist in namespace
        arg = self.arg
        return 'bind({})'.format(str(arg))

#AccCache: 'cache' '(' args+=ID[','] ')';
class AccCache(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.args = kwargs.pop('args')

        super(AccCache, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccCache: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(arg) for arg in self.args)
        return 'cache({})'.format(args)
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
"""
        self.args = kwargs.pop('args')

        super(AccDevice, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccDevice: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(arg) for arg in self.args)
        return 'device({})'.format(args)

#AccDeviceNum: 'device_num' '(' n=INT ')';
class AccDeviceNum(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.n = kwargs.pop('n')

        super(AccDeviceNum, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccDeviceNum: expr")

        return 'device_num({})'.format(self.n)

#AccDevicePtr: 'deviceptr' '(' args+=ID[','] ')';
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
def __init__(self, **kwargs):
        """
        """
        self.n = kwargs.pop('n')

        super(AccCollapse, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccCollapse: expr")

        return 'collapse({})'.format(self.n)

#AccCopy: 'copy' '(' args+=ID[','] ')';
class AccCopy(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.args = kwargs.pop('args')

        super(AccCopy, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccCopy: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(arg) for arg in self.args)
        return 'copy({})'.format(args)
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
"""
        self.args = kwargs.pop('args')

        super(AccSelf, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccSelf: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(arg) for arg in self.args)
        return 'self({})'.format(args)

#AccSeq: 'seq';
class AccSeq(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        super(AccSeq, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccSeq: expr")

        return 'seq'

#AccTile: 'tile' '(' args+=ID[','] ')';
class AccTile(AccBasic):
    """Class representing a ."""
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
"""
        self.args = kwargs.pop('args')

        super(AccDelete, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccDelete: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(arg) for arg in self.args)
        return 'delete({})'.format(args)

#AccDevice: 'device' '(' args+=ID[','] ')';
class AccDevice(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.args = kwargs.pop('args')

        super(AccDevice, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccDevice: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(arg) for arg in self.args)
        return 'device({})'.format(args)
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
"""
        self.args = kwargs.pop('args')

        super(AccUseDevice, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccUseDevice: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(arg) for arg in self.args)
        return 'use_device({})'.format(args)

#AccVector: 'vector' ('(' args+=VectorArg ')')?;
class AccVector(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.args = kwargs.pop('args')

        super(AccVector, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccVector: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(a.arg) for a in self.args)
        return 'vector({})'.format(args)
github pyccel / pyccel / pyccel / parser / syntax / openacc.py View on Github external
class AccSeq(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        super(AccSeq, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccSeq: expr")

        return 'seq'

#AccTile: 'tile' '(' args+=ID[','] ')';
class AccTile(AccBasic):
    """Class representing a ."""
    def __init__(self, **kwargs):
        """
        """
        self.args = kwargs.pop('args')

        super(AccTile, self).__init__(**kwargs)

    @property
    def expr(self):
        if DEBUG:
            print("> AccTile: expr")

        # TODO check if variable exist in namespace
        args = ', '.join(str(arg) for arg in self.args)
        return 'tile({})'.format(args)