void init_delayed_Alltoall(int send_count, MPI_Datatype send_dt, int recv_count, MPI_Datatype recv_dt, double delay, int node) { set_send_buffer_usage(get_measurement_size()*get_extent(send_count, send_dt)); set_recv_buffer_usage(get_measurement_size()*get_extent(recv_count, recv_dt)); set_reported_message_size(get_extent(send_count, send_dt)); init_synchronization(); }
void init_delayed_Gather(int send_count, MPI_Datatype send_dt, int recv_count, MPI_Datatype recv_dt, int root, double delay, int node) { set_send_buffer_usage(get_extent(send_count, send_dt)); set_reported_message_size(get_extent(send_count, send_dt)); if( get_measurement_rank() == root ) set_recv_buffer_usage(get_measurement_size()*get_extent(recv_count, recv_dt)); else set_recv_buffer_usage(0); init_synchronization(); }
/** * \brief Initialization function of measure function * measure_MPI_IO_read_file_once(). * * Only one process is active. It reads once from a file. * * Remark:<br> * With the <tt>O_DIRECT</tt> flag set, cache effects are minimized, because I/O * is done directly to/from user space buffers. The operation system's page * cache is bypassed. Under Linux 2.6 alignment to 512-byte boundaries is * required for buffer and file offset. Thus the following parameters should be * set in a SKaMPI input file: * - <tt>set_send_buffert_alignment (512)</tt> * - <tt>set_recv_buffert_alignment (512)</tt> * - <tt>switch_buffer_cycling_off ()</tt><br> * * <tt>O_DIRECT</tt> is only relevant if the POSIX-API is used for I/O. * * For more information please refer to the <tt>open ()</tt> man pages. * * \param[in] size size of memory buffer, i.e. number of <tt>MPI_BYTE</tt>s * \param[in] api POSIX-API or MPI-API for I/O accesses * \param[in] directio_flag open file with <tt>O_DIRECT</tt> flag to minimize * cache effects * * \return void */ void init_MPI_IO_read_file_once (int size, char *api, int directio_flag) { char *send_buffer; assert (size > 0); io_filename = get_io_filename (IO_FILENAME, 0); if (get_measurement_rank () == 0){ send_buffer = mpi_malloc_chars (get_extent (size, MPI_BYTE)); MPI_File_open (MPI_COMM_SELF, io_filename, MPI_MODE_WRONLY | MPI_MODE_CREATE | MPI_MODE_UNIQUE_OPEN, MPI_INFO_NULL, &io_fh); MPI_File_set_view (io_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL); MPI_File_write (io_fh, send_buffer, size, MPI_BYTE, MPI_STATUS_IGNORE); MPI_File_close (&io_fh); mpi_free (send_buffer); set_recv_buffer_usage (size); set_reported_message_size (size); } MPI_Barrier (get_measurement_comm ()); /* set synchronization type: SYNC_BARRIER if all SKaMPI processes run on one physical processor SYNC_REAL if every SKaMPI process runs on its own physical processor */ set_synchronization (SYNC_REAL); init_synchronization (); }
// ------------------------------------------------------------------ // window for a bitmap-based mouse // on adding child, expand to include child's extents. // ------------------------------------------------------------------ void t_mouse_window::add_child( t_window* window ) { t_window::add_child( window ); t_screen_rect rect = get_screen_rect(); if (rect.height() == 0) rect = window->get_screen_rect(); else rect = get_extent( rect, window->get_screen_rect() ); // change window's size. move_screen_rect( rect, false ); }
static int _dfs_open(const char *path, struct fuse_file_info *fi) { DfsFile *f; dfs_out("\n\tFUSE OPEN '%s'\n\n", path); if (!(f = findFile((char *)path))) { return -ENOENT; } long flags = fi ? fi->flags : 0; dfs_out("\tOPEN : '%s', flags %o, len %d, reclen %d, recipe %x, data %x\n", path, flags, f->len, f->recipelen, f->recipe, f->data); if (f->stat.st_mode & S_IFDIR) { return -EISDIR; } if (0 && !(fi->flags & f->stat.st_mode)) { dfs_out("OPEN permissions problem: %o, %o\n", fi->flags, f->stat.st_mode); return -EACCES; } // Why? don't remember.... fi->fh = (uint64_t)f->stat.st_mode; if (f->len && !f->data) { assert(f->recipe); f->data = malloc(f->len); assert(f->data); char *data = f->data, *dataEnd = f->data + f->len; char *sig = f->recipe, *sigEnd = f->recipe + f->recipelen; while ((data < dataEnd) && (sig < sigEnd)) { Extent *ex = get_extent(sig); if (!ex) dfs_die("No get signature '%s'\n", sig); memcpy(data, ex->data, ex->sz); data += ex->sz; sig += strlen(sig) + 1; free(ex); } assert((data == dataEnd) && (sig == sigEnd)); } return 0; }
// -------------------------------------------------------- // compute the button's size. // -------------------------------------------------------- t_screen_rect t_button::compute_size() { t_window_list::iterator index = get_children_begin(); t_screen_rect rect(0,0,0,0); // exit if there are no children. if (index == get_children_end()) return rect; // find the total screen rectangle occupied by all children rect = (*index)->get_screen_rect(); index++; while (index != get_children_end()) { rect = get_extent( (*index)->get_screen_rect(), rect ); index++; } return rect; }
bool aabb2<T>::intersect_with_line(const vec2<T>& linemiddle, const vec2<T>& linevect, T halflength) const { const vec2<T> e = get_extent() * (T)0.5; const vec2<T> t = get_center() - linemiddle; if ( (abs(t.x) > e.x + halflength * abs(linevect.x)) || (abs(t.y) > e.y + halflength * abs(linevect.y))) { return false; } T r = e.x * (T)abs(linevect.y) + e.y * (T)abs(linevect.x); if (abs(t.x*linevect.y - t.y*linevect.x) > r) { return false; } return true; }
/** controlling daemon main loop */ static int main_loop(struct program_params *pp) { int ret; const char *lv_name = get_first_volume_name(pp); while (!stop) { // if move daemon is working, wait 5 minutes, start from beginning switch(move_daemon_status(pp, lv_name)) { case PVMOVE_WORKING: sleep(get_pvwait(pp, lv_name)); continue; break; case PVMOVE_IDLE: break; /* do nothing, continue */ default: fprintf(stderr, "Unknown response from move_daemon_status()\n"); goto no_cleanup; break; } // refresh stats, read new stats from file struct extent_stats *es = NULL; ret = get_volume_stats(pp, lv_name, &es); if (ret) { fprintf(stderr, "get_extent_stats error\n"); break; } // get most used min(100,free_space) extents (read and write multipliers from // config file), check if they're on fast or slow storage // move hot extents from slow storage, queue the move in move daemon // continue if move queued for (int tier=0; tier<TIER_MAX; tier++) { if (!lower_tiers_exist(pp, lv_name, tier)) break; off_t free_space = get_avaiable_space(pp, lv_name, tier); if (free_space < 0) { fprintf(stderr, "get_free_space error\n"); goto no_cleanup; } if (free_space == 0) continue; // always leave 5 extents worth of free space so that we always // can move cold extents from higher tier off_t available_extents = free_space / get_extent_size(pp, lv_name) - 5; if (available_extents < 0) available_extents = 0; struct extents *ext = NULL; // get next hottest min(100, free_space) extents size_t max_extents = 100; if (max_extents > available_extents) max_extents = available_extents; ret = extents_selector(es, &ext, pp, lv_name, tier, max_extents, ES_HOT); if (ret) { fprintf(stderr, "extents_selector error\n"); goto no_cleanup; } if (!ext->length) { free_extents(ext); continue; } printf("Moving extents to higher tier\n"); // move them from slow storage, // until no space left ret = queue_extents_move(ext, pp, lv_name, tier); if (ret) { fprintf(stderr, "Can't queue extents move\n"); goto no_cleanup; } free_extents(ext); if (!stop) sleep(get_pvwait(pp, lv_name)); // continue main loop, free memory before goto cont; } printf("All high tiers full\n"); // pin extents to their current physical volumes, this will cause them // to be moved only when the temperature difference is large ret = add_pinning_scores(es, pp, lv_name); if (ret) { fprintf(stderr, "can't add pining scores\n"); goto no_cleanup; } // If there are blocks in slow storage with higher // score than ones in fast storage, move 10 worst extents from fast to slow // if move queued, continue struct extents *prev_tier_max = NULL; int prev_tier = -1; for (int tier = TIER_MAX; tier >= 0; tier--) { off_t free_space = get_avaiable_space(pp, lv_name, tier); if (free_space < 0) { fprintf(stderr, "get_avaiable_space error\n"); goto no_cleanup; } if (!free_space) { if (higher_tiers_exist(pp, lv_name, tier)) continue; else break; } struct extents *curr_tier_min = NULL; printf("trying to move cold extents from tier %i\n", tier); if (!prev_tier_max) { // get base line extents ret = extents_selector(es, &prev_tier_max, pp, lv_name, tier-1, 5, ES_HOT); if (ret) { fprintf(stderr, "extent_selector error\n"); goto no_cleanup; } prev_tier = tier; continue; } ret = extents_selector(es, &curr_tier_min, pp, lv_name, tier, 5, ES_COLD); if (ret) { fprintf(stderr, "%s:%i: extent_selector error\n", __FILE__, __LINE__); goto no_cleanup; } printf("low tier best: %f\n", prev_tier_max->extents[0]->score); printf("high tier worst: %f\n", curr_tier_min->extents[0]->score); // check if extents in lower tier are hotter if (compare_extents(prev_tier_max, curr_tier_min) > 0) { float prev_score = get_extent_score(get_extent(prev_tier_max, 0)); float curr_score = get_extent_score(get_extent(curr_tier_min, 0)); // don't move more extents that would push very hot extents // to low tier or cold extents to higher tier when there is // more cold extents to swap than hotter and vice-versa int prev_count = count_extents(prev_tier_max, curr_score, ES_COLD); int curr_count = count_extents(curr_tier_min, prev_score, ES_HOT); int move_extents = (prev_count > curr_count)?curr_count:prev_count; truncate_extents(prev_tier_max, move_extents); truncate_extents(curr_tier_min, move_extents); // queue move of extents that remain ret = queue_extents_move(prev_tier_max, pp, lv_name, tier); if (ret) { fprintf(stderr, "%s:%i: queue extents failed\n", __FILE__, __LINE__); goto no_cleanup; } ret = queue_extents_move(curr_tier_min, pp, lv_name, prev_tier); if (ret) { fprintf(stderr, "%s:%i: queue extents failed\n", __FILE__, __LINE__); goto no_cleanup; } } else { printf("Nothing to do\n"); } free_extents(curr_tier_min); free_extents(prev_tier_max); prev_tier_max = NULL; // remember previous tier extents ret = extents_selector(es, &prev_tier_max, pp, lv_name, tier, 5, ES_HOT); if (ret) { fprintf(stderr, "%s:%i: Extent_selector error\n", __FILE__, __LINE__); goto no_cleanup; } prev_tier = tier; } // wait 10 minutes if (!stop) sleep(get_check_wait(pp, lv_name)); cont: free_extent_stats(es); } no_cleanup: if (stop) return 0; else return 1; }
T aabb2<T>::get_area() const { const vec2<T> e = get_extent(); return e.x * e.y; }
T aabb2<T>::get_radius_sq() const { return length_sq(get_extent()) * 0.25f; }
T aabb2<T>::get_radius_fast() const { float radiusSq = length_sq(get_extent()) * 0.25f; return sqrt(radiusSq); }
T aabb2<T>::get_radius() const { return length(get_extent()) * 0.5f; }