예제 #1
0
    # If we are in a gpu group, with tp
    if withtp and worker.gpu_id >= 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()
예제 #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):
                PS_longitudinal_intensity.induced_voltage_sum()
            elif (approx == 1) and (turn % n_turns_reduce == 0):
                PS_longitudinal_intensity.induced_voltage_sum()
            tracker.pre_track()
        # else:
        #     pass

        worker.gpuSync()

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

        worker.intraSync()
        worker.sendrecv(PS_longitudinal_intensity.induced_voltage,
                        tracker.rf_voltage)
    else: