Esempio n. 1
0
int main(int argc, char *argv[]){
        int i, start_node, end_node;
	struct timeval p,q;
        total_nodes = -1;

        if(argc > 4 || argc < 3){
                perror("Incorrect command line arguments\n");
                exit(-1);
        }
        file = fopen(argv[1],"r");
        initialize_topology();
//	if(argc == 3)
//	        end_node = atoi(argv[2]);
//	else
//		end_node = total_nodes;
	start_node = atoi(argv[2]) - 1;
//	gettimeofday(&p,NULL);
	if(argc == 4){
		end_node = atoi(argv[3]);
		tiernan(start_node, end_node);
	}
	else{
		tiernan(start_node, start_node + 1);
	}
//	gettimeofday(&q,NULL);
//	printf("Running Time is: %8ld\n\n", q.tv_usec - p.tv_usec + (q.tv_sec-p.tv_sec)*1000000);

}
Esempio n. 2
0
Topology::Topology()
	: m_topology(initialize_topology())
	, m_available_processing_units(enumerate_processing_units(m_topology))
	, m_available_numa_nodes(enumerate_numa_nodes(m_topology))
	, m_processing_units_per_node(m_available_numa_nodes.size())
{
	const auto num_nodes = m_available_numa_nodes.size();
	for(const auto pu : m_available_processing_units){
		if(num_nodes == 1){
			++m_processing_units_per_node[0];
		}else{
			auto obj = hwloc_get_obj_by_type(m_topology, HWLOC_OBJ_PU, pu);
			while(obj && obj->type != HWLOC_OBJ_NODE){ obj = obj->parent; }
			if(obj && obj->type == HWLOC_OBJ_NODE){
				const auto it = std::find(
					m_available_numa_nodes.begin(),
					m_available_numa_nodes.end(),
					obj->logical_index);
				const auto index = it - m_available_numa_nodes.begin();
				++m_processing_units_per_node[index];
			}else{
				++m_processing_units_per_node[0];
			}
		}
	}
}
Esempio n. 3
0
void SurfaceEdgeCollapse::preprocess(int &red_tri)
{
    int i;
    remove_flat_triangles(red_tri);
    initialize_connectivity();

    for (i = 0; i < num_points; i++)
    {
        initialize_topology(i);
        angle[i] = vertex_on_feature_edge(i, max_angle);
    }
    make_priority_queue();
}
Esempio n. 4
0
/*-------------------------------------------------------------------*/
void sge_setup_sge_execd(sge_gdi_ctx_class_t *ctx, const char* tmp_err_file_name)
{
   char err_str[MAX_STRING_SIZE];
   int allowed_get_conf_errors     = 5;
   char* spool_dir = NULL;
   const char *unqualified_hostname = ctx->get_unqualified_hostname(ctx);
   const char *admin_user = ctx->get_admin_user(ctx);

   DENTER(TOP_LAYER, "sge_setup_sge_execd");

   /* TODO: is this the right place to switch the user ?
            ports below 1024 ok */
   /*
   ** switch to admin user
   */
   if (sge_set_admin_username(admin_user, err_str)) {
      CRITICAL((SGE_EVENT, SFNMAX, err_str));
      /* TODO: remove */
      SGE_EXIT(NULL, 1);
   }

   if (sge_switch2admin_user()) {
      CRITICAL((SGE_EVENT, SFNMAX, MSG_ERROR_CANTSWITCHTOADMINUSER));
      /* TODO: remove */
      SGE_EXIT(NULL, 1);
   }

   while (gdi2_wait_for_conf(ctx, &Execd_Config_List)) {
      if (allowed_get_conf_errors-- <= 0) {
         CRITICAL((SGE_EVENT, SFNMAX, MSG_EXECD_CANT_GET_CONFIGURATION_EXIT));
         /* TODO: remove */
         SGE_EXIT(NULL, 1);
      }
      sleep(1);
      ctx->get_master(ctx, true);
   }
   sge_show_conf();         


   /* get aliased hostname */
   /* TODO: is this call needed ? */
   ctx->reresolve_qualified_hostname(ctx);
   spool_dir = mconf_get_execd_spool_dir();

   DPRINTF(("chdir(\"/\")----------------------------\n"));
   sge_chdir_exit("/",1);
   DPRINTF(("Making directories----------------------------\n"));
   sge_mkdir(spool_dir, 0755, 1, 0);
   DPRINTF(("chdir(\"%s\")----------------------------\n", spool_dir));
   sge_chdir_exit(spool_dir,1);
   sge_mkdir(unqualified_hostname, 0755, 1, 0);
   DPRINTF(("chdir(\"%s\",me.unqualified_hostname)--------------------------\n",
            unqualified_hostname));
   sge_chdir_exit(unqualified_hostname, 1); 
   /* having passed the  previous statement we may 
      log messages into the ERR_FILE  */
   if ( tmp_err_file_name != NULL) {
      sge_copy_append((char*)tmp_err_file_name, ERR_FILE, SGE_MODE_APPEND);
   }
   sge_switch2start_user();
   if ( tmp_err_file_name != NULL) {
      unlink(tmp_err_file_name);
   }
   sge_switch2admin_user();
   log_state_set_log_as_admin_user(1);
   sprintf(execd_messages_file, "%s/%s/%s", spool_dir, 
           unqualified_hostname, ERR_FILE);
   log_state_set_log_file(execd_messages_file);

   sprintf(execd_spool_dir, "%s/%s", spool_dir, 
           unqualified_hostname);
   
   DPRINTF(("Making directories----------------------------\n"));
   sge_mkdir(EXEC_DIR, 0775, 1, 0);
   sge_mkdir(JOB_DIR, 0775, 1, 0);
   sge_mkdir(ACTIVE_DIR,  0775, 1, 0);

#if defined(PLPA_LINUX) || defined(SOLARIS86) || defined(SOLARISAMD64)
   /* initialize processor topology */
   if (initialize_topology() != true) {
      DPRINTF(("Couldn't initizalize topology-----------------------\n"));
   }
#endif

   sge_free(&spool_dir);
   DRETURN_VOID;
}