double syr2krect(size_t N, size_t iterations = 1){ Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> A(N, size_t(1.5*N)), B(N, size_t(1.5*N)), C(N, N); value_type c = 3, d = 5; rminit(N, 1.5*N, A); rminit(N, 1.5*N, B); minit(N, C); std::vector<double> times; for(size_t i = 0; i < iterations; ++i){ auto start = std::chrono::steady_clock::now(); //C = c * B * A.transpose() + c * A * B.transpose() + d * C; C *= d; C += c * A * B.transpose(); C += c * B * A.transpose(); auto end = std::chrono::steady_clock::now(); auto diff = end - start; times.push_back(std::chrono::duration<double, std::milli> (diff).count()); //save time in ms for each iteration } double tmin = *(std::min_element(times.begin(), times.end())); double tavg = average_time(times); // check to see if nothing happened during run to invalidate the times if(variance(tavg, times) > max_variance){ std::cerr << "eigen kernel 'syr2krect': Time deviation too large! \n"; } return tavg; }
void dvma_init() { vm_offset_t segmap_addr; /* * Create phys_map covering the entire DVMA space, * then allocate the segment pool from that. The * remainder will be used as the DVMA page pool. */ phys_map = uvm_map_create(pmap_kernel(), DVMA_MAP_BASE, DVMA_MAP_END, 1); if (phys_map == NULL) panic("unable to create DVMA map"); /* * Reserve the DVMA space used for segment remapping. * The remainder of phys_map is used for DVMA scratch * memory pages (i.e. driver control blocks, etc.) */ segmap_addr = uvm_km_valloc_wait(phys_map, dvma_segmap_size); if (segmap_addr != DVMA_MAP_BASE) panic("dvma_init: unable to allocate DVMA segments"); /* * Create the VM pool used for mapping whole segments * into DVMA space for the purpose of data transfer. */ rminit(dvma_segmap, dvma_segmap_size, segmap_addr, "dvma_segmap", NUM_DVMA_SEGS); }
double syr2krect(size_t N, size_t iterations = 1){ typedef mtl::tag::row_major row_major; typedef mtl::mat::parameters<row_major> parameters; typedef mtl::dense2D<value_type, parameters> dense2D; typedef mtl::dense_vector<value_type> dense_vector; dense2D A(N, 1.5*N), B(N, 1.5*N), C(N, N); value_type c = 3, d = 5; rminit(N, 1.5*N, A); rminit(N, 1.5*N, B); minit(N, C); std::vector<double> times; for(size_t i = 0; i < iterations; ++i){ auto start = std::chrono::steady_clock::now(); //C = c * B * trans(A) + c * A * trans(B) + d * C; C *= d; C += c * A * trans(B); C += c * B * trans(A); auto end = std::chrono::steady_clock::now(); auto diff = end - start; times.push_back(std::chrono::duration<double, std::milli> (diff).count()); //save time in ms for each iteration } double tmin = *(std::min_element(times.begin(), times.end())); double tavg = average_time(times); // check to see if nothing happened during run to invalidate the times if(variance(tavg, times) > max_variance){ std::cerr << "mtl kernel 'syr2krect': Time deviation too large! \n"; } return tavg; }
void dvma_init() { /* * Create the resource map for DVMA pages. */ dvmamap = malloc((sizeof(struct map) * dvma_max_segs), M_DEVBUF, M_WAITOK); rminit(dvmamap, btoc(DVMA_MAP_AVAIL), btoc(DVMA_MAP_BASE), "dvmamap", dvma_max_segs); /* * Enable DVMA in the System Enable register. * Note: This is only necessary for VME slave accesses. * On-board devices are always capable of DVMA. */ *enable_reg |= ENA_SDVMA; }