static void sum_ddir(struct thread_data *dst, struct thread_data *src, enum fio_ddir ddir) { pthread_double_lock(&dst->io_wq.stat_lock, &src->io_wq.stat_lock); sum_val(&dst->io_bytes[ddir], &src->io_bytes[ddir]); sum_val(&dst->io_blocks[ddir], &src->io_blocks[ddir]); sum_val(&dst->this_io_blocks[ddir], &src->this_io_blocks[ddir]); sum_val(&dst->this_io_bytes[ddir], &src->this_io_bytes[ddir]); sum_val(&dst->bytes_done[ddir], &src->bytes_done[ddir]); pthread_double_unlock(&dst->io_wq.stat_lock, &src->io_wq.stat_lock); }
static void sum_ddir(struct thread_data *dst, struct thread_data *src, enum fio_ddir ddir) { #ifndef CONFIG_SFAA pthread_mutex_lock(&dst->io_wq.stat_lock); pthread_mutex_lock(&src->io_wq.stat_lock); #endif sum_val(&dst->io_bytes[ddir], &src->io_bytes[ddir]); sum_val(&dst->io_blocks[ddir], &src->io_blocks[ddir]); sum_val(&dst->this_io_blocks[ddir], &src->this_io_blocks[ddir]); sum_val(&dst->this_io_bytes[ddir], &src->this_io_bytes[ddir]); sum_val(&dst->bytes_done[ddir], &src->bytes_done[ddir]); #ifndef CONFIG_SFAA pthread_mutex_unlock(&src->io_wq.stat_lock); pthread_mutex_unlock(&dst->io_wq.stat_lock); #endif }
Real dot(const Vector<Real> &x) const { const std::vector<Real> &xval = *(Teuchos::dyn_cast<const StdVector<Real> >(x).getVector()); const std::vector<Real> &yval = *(StdVector<Real>::getVector()); uint numMySamples = static_cast<uint>(yval.size()); TEUCHOS_TEST_FOR_EXCEPTION( xval.size() != numMySamples, std::invalid_argument, "Error: Vectors must have the same dimension." ); Real val(0), sum_val(0); for (uint i = 0; i < numMySamples; i++) { val += xval[i] * yval[i] / (*scale_)[i]; } // Global sum BatchStdVector<Real>::getBatchManager()->sumAll(&val,&sum_val,1); return sum_val; }