Example #1
0
        if worker.hasGPU:
            if (turn < 8 * int(FBtime)):
                longCavityImpedanceReduction.track()
                shortCavityImpedanceReduction.track()
            if (approx == 0) or (approx == 2):
                inducedVoltage.induced_voltage_sum()
            elif (approx == 1) and (turn % n_turns_reduce == 0):
                inducedVoltage.induced_voltage_sum()
            tracker.pre_track()

        worker.gpuSync()

        # Here I need to broadcast the calculated stuff
        inducedVoltage.induced_voltage = worker.broadcast(
            inducedVoltage.induced_voltage)
        tracker.rf_voltage = worker.broadcast(tracker.rf_voltage)
    # else just do the normal task-parallelism
    elif withtp:
        if worker.isFirst:
            if (turn < 8 * int(FBtime)):
                longCavityImpedanceReduction.track()
                shortCavityImpedanceReduction.track()
            if (approx == 0) or (approx == 2):
                inducedVoltage.induced_voltage_sum()
            elif (approx == 1) and (turn % n_turns_reduce == 0):
                inducedVoltage.induced_voltage_sum()
        if worker.isLast:
            tracker.pre_track()

        worker.intraSync()
        worker.sendrecv(inducedVoltage.induced_voltage, tracker.rf_voltage)
Example #2
0
    # If we are in a gpu group, with tp
    if withtp and worker.gpu_id >= 0:
        if worker.hasGPU:
            if (approx == 0) or (approx == 2):
                totVoltage.induced_voltage_sum()
            elif (approx == 1) and (turn % n_turns_reduce == 0):
                totVoltage.induced_voltage_sum()
        else:
            tracker.pre_track()

        worker.gpuSync()

        # Here I need to broadcast the calculated stuff
        totVoltage.induced_voltage = worker.broadcast(totVoltage.induced_voltage)
        tracker.rf_voltage = worker.broadcast(tracker.rf_voltage, root=1)
    # else just do the normal task-parallelism
    elif withtp:
        if worker.isFirst:
            if (approx == 0) or (approx == 2):
                totVoltage.induced_voltage_sum()
            elif (approx == 1) and (turn % n_turns_reduce == 0):
                totVoltage.induced_voltage_sum()
        if worker.isLast:
            tracker.pre_track()

        worker.intraSync()
        worker.sendrecv(totVoltage.induced_voltage, tracker.rf_voltage)
    else:
        if (approx == 0) or (approx == 2):
            totVoltage.induced_voltage_sum()