示例#1
0
    barrier_node::barrier_node(std::string base_name, std::size_t num, std::size_t rank)
      : count_(0),
        base_name_(base_name),
        rank_(rank),
        num_(num),
        arity_(std::stol(get_config_entry("hpx.lcos.collectives.arity", 32))),
        cut_off_(std::stol(get_config_entry("hpx.lcos.collectives.cut_off", 256))),
        local_barrier_(num)
    {
        if (num_ >= cut_off_)
        {
            std::vector<std::size_t> ids;
            ids.reserve(children_.size());

            for (std::size_t i = 1; i <= arity_; ++i)
            {
                std::size_t id = (arity_ * rank_) + i;
                if (id >= num) break;
                ids.push_back(id);
            }

            children_ = hpx::util::unwrapped(
                hpx::find_from_basename(base_name_, ids));

            return;
        }

        if (rank_ != 0)
        {
            HPX_ASSERT(num_ < cut_off_);
            children_.push_back(hpx::find_from_basename(base_name_, 0).get());
        }
    }
示例#2
0
 /// Attach the debugger if this is enabled in the config
 static void may_attach_debugger()
 {
     if (get_config_entry("hpx.attach-debugger", "") == "test-failure")
     {
         attach_debugger();
     }
 }
示例#3
0
    void report_exception_and_continue(hpx::exception const& e)
    {
        if (!expect_exception_flag.load(std::memory_order_relaxed) &&
            get_config_entry("hpx.attach_debugger", "") == "exception")
        {
            util::attach_debugger();
        }

        std::cerr << hpx::diagnostic_information(e) << std::endl;
    }
示例#4
0
 HPX_EXPORT void throw_exception(Exception const& e, std::string const& func,
     std::string const& file, long line)
 {
     if (!expect_exception_flag.load(std::memory_order_relaxed) &&
         get_config_entry("hpx.attach_debugger", "") == "exception")
     {
         util::attach_debugger();
     }
     std::rethrow_exception(get_exception(e, func, file, line));
 }
示例#5
0
    void assertion_failed_msg(char const* msg, char const* expr,
        char const* function, char const* file, long line)
    {
        if (!expect_exception_flag.load(std::memory_order_relaxed) &&
            get_config_entry("hpx.attach_debugger", "") == "exception")
        {
            util::attach_debugger();
        }

        bool threw = false;

        std::string str("assertion '" + std::string(msg) + "' failed");
        if (expr != msg)
            str += " (" + std::string(expr) + ")";

        try {
            boost::filesystem::path p(hpx::util::create_path(file));
            hpx::detail::throw_exception(
                hpx::exception(hpx::assertion_failure, str),
                function, p.string(), line);
        }
        catch (...) {
            threw = true;

            // If the runtime pointer is available, we can safely get the prefix
            // of this locality. If it's not available, then just terminate.
            runtime* rt = get_runtime_ptr();
            if (nullptr != rt)  {
                rt->report_error(std::current_exception());
            }
            else {
                std::cerr << "Runtime is not available, reporting error locally. "
                    << hpx::diagnostic_information(std::current_exception())
                    << std::flush;
            }
        }

        // If the exception wasn't thrown, then print out the assertion message,
        // so that the program doesn't abort without any diagnostics.
        if (!threw) {
            std::cerr << "Runtime is not available, reporting error locally\n"
                         "{what}: " << str << std::endl;
        }
        std::abort();
    }
示例#6
0
//there has to be a better way to do this :/
void Run(void)
{
  
    char *ce; 
    SetSig       ();
    Banner       ();

        if ((ce = (char *)get_config_entry("?omega", "version")))
        {
			if (CONFIG_VERSION != atoi(ce))
			{
				fprintf(stderr, "\033[1;31mCRITICAL\033[0m: Invalid configuration file version. [Given: %s][Required: %d]", ce, CONFIG_VERSION); 
				Exit(0);	
			}	
	} else { 
		fprintf(stderr, "\033[1;31mERROR\033[0m: Unable to determine the configuration file version. Please make sure you have all <?omega> intact\n");
		fprintf(stderr, "Assuming configuration version \033[1;31m%d\033[0m\n\n", CONFIG_VERSION);
	} 

#ifdef HAVE_SETPROCTITLE
    setproctitle("%s", CfgSettings.servername);
#endif

    open_log  ();
    init_uid ();
	
    AddEventEx ("House Keeping", 900, EVENT_UNLIMITED, ev_housekeeping);
 
    AddEvent ("BURST", burst_local_users);
    AddEvent ("BURST", burst_local_servers);
    AddEvent ("CONNECT", introduce_users);
	
    if ((Omega->me = new_serv(NULL, CfgSettings.servername)))
    {
        strlcpy (Omega->me->sid, CfgSettings.sid, sizeof(Omega->me->sid));
        Omega->me->eos = 1; //mark us as already EOS'ed
    }
    else
    {
		fprintf (stderr, "Unable to create our server entry\n");
		exit (0);
    }

    /*
     * Initialize our core for running
     */

	database_init (); 
    protocol_init ();
	
    servsock    	 = add_new_socket ((void*) psr_HandleEvent, NULL);
    servsock->flags	|= SOCK_UPLINK;
	strlcpy (servsock->name, "Uplink", sizeof(servsock->name));

#ifdef HAVE_GNUTLS
        servsock->tls_enabled   = get_config_bool("link", "gnutls", 0);
#endif
	
    psr_init      ();
	init_access();

	init_modules();
	introduce_users (0, NULL);

    /*
     * Connect to the IRCd if we don't connect Add an event to connect...
     */

    printf ("\r\n");
    printf ("Connecting to \033[1;32m%s\033[0m port \033[1;32m%d\033[0m\033[0m\n", CfgSettings.uplink, CfgSettings.port);
    if (Connect (servsock, CfgSettings.uplink, CfgSettings.local_ip, CfgSettings.port))
        ircd_connect ();
    else
        AddEventEx ("Connect Uplink", 60, 3, ev_connectuplink);

    /*
     * Okay begin
     */

    OneTimeAround   ();

    return;
}
示例#7
0
/* Get the IPA server from the configuration file.
 * The caller is responsible for freeing this value
 */
static char *
getIPAserver(char * data) {
    return get_config_entry(data, "global", "server");
}