示例#1
0
    def expr(self):
        if DEBUG:
            print("> AccWaitDirective: expr")

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

        return AnnotatedComment('acc', txt)
示例#2
0
    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)
示例#3
0
    def expr(self):
        if DEBUG:
            print("> OmpSingleConstruct: expr")

        _valid_clauses = (OmpPrivate, \
                         OmpFirstPrivate)

        txt = 'single'
        for clause in self.clauses:
            if isinstance(clause, _valid_clauses):
                txt = '{0} {1}'.format(txt, clause.expr)
            else:
                raise TypeError('Wrong clause for OmpSingleConstruct')

        return AnnotatedComment('omp', txt)
示例#4
0
    def expr(self):
        if DEBUG:
            print("> AccSetDirective: expr")

        _valid_clauses = (AccDefaultAsync, AccDeviceType, AccDeviceNum)

        txt = 'set'
        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)
示例#5
0
    def expr(self):
        if DEBUG:
            print("> AccHostDataDirective: expr")

        _valid_clauses = (AccUseDevice)

        txt = 'host_data'
        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)
示例#6
0
    def expr(self):
        if DEBUG:
            print("> AccEnterDataDirective: expr")

        _valid_clauses = (AccIf, AccAsync, AccWait, AccCopyin, AccCreate)

        txt = 'enter data'
        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)
示例#7
0
    def expr(self):
        if DEBUG:
            print("> AccRoutineDirective: expr")

        _valid_clauses = (AccGang, AccWorker, 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)
示例#8
0
    def expr(self):
        if DEBUG:
            print("> AccUpdateDirective: expr")

        _valid_clauses = (AccAsync, AccWait, AccDeviceType, AccIf,
                          AccIfPresent, AccSelf, AccHost, AccDevice)

        txt = 'update'
        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)
示例#9
0
    def expr(self):
        if DEBUG:
            print("> AccDeclareDirective: expr")

        _valid_clauses = (AccCopy, AccCopyin, AccCopyout, AccCreate,
                          AccPresent, AccDevicePtr, AccDeviceResident, AccLink)

        txt = 'declare'
        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)
示例#10
0
    def expr(self):
        if DEBUG:
            print("> AccLoopConstruct: expr")

        _valid_clauses = (AccCollapse, AccGang, AccWorker, AccVector, AccSeq,
                          AccAuto, AccTile, AccDeviceType, AccIndependent,
                          AccPrivate, AccReduction)

        txt = 'loop'
        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)
示例#11
0
    def expr(self):
        if DEBUG:
            print("> AccKernelsConstruct: expr")

        _valid_clauses = (AccAsync, AccWait, AccNumGangs, AccNumWorkers,
                          AccVectorLength, AccDeviceType, AccIf, AccCopy,
                          AccCopyin, AccCopyout, AccCreate, AccPresent,
                          AccDevicePtr, AccDefault)

        txt = 'kernels'
        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)
示例#12
0
    def expr(self):
        if DEBUG:
            print("> OmpParallelConstruct: expr")

        _valid_clauses = (OmpNumThread, \
                         OmpDefault, \
                         OmpPrivate, \
                         OmpShared, \
                         OmpFirstPrivate, \
                         OmpCopyin, \
                         OmpReduction, \
                         OmpProcBind)

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

        return AnnotatedComment('omp', txt)
示例#13
0
    def expr(self):
        if DEBUG:
            print("> OmpLoopConstruct: expr")

        _valid_clauses = (OmpPrivate, \
                         OmpFirstPrivate, \
                         OmpLastPrivate, \
                         OmpReduction, \
                         OmpSchedule, \
                         OmpCollapse, \
                         OmpLinear, \
                         OmpOrdered)

        txt = 'do'
        for clause in self.clauses:
            if isinstance(clause, _valid_clauses):
                txt = '{0} {1}'.format(txt, clause.expr)
            else:
                raise TypeError('Wrong clause for OmpLoopConstruct. Given : ', \
                                type(clause))

        return AnnotatedComment('omp', txt)
示例#14
0
    def expr(self):
        if DEBUG:
            print("> OmpEndClause: expr")

        txt = 'end {0} {1} {2}'.format(self.construct, self.simd, self.nowait)
        return AnnotatedComment('omp', txt)
示例#15
0
    def expr(self):
        if DEBUG:
            print("> AccEndClause: expr")

        txt = 'end {0}'.format(self.construct)
        return AnnotatedComment('acc', txt)