コード例 #1
0
ファイル: libnuma.c プロジェクト: Agobin/chapel
qthread_worker_id_t INTERNAL guess_num_workers_per_shep(qthread_shepherd_id_t nshepherds)
{                                      /*{{{ */
    size_t       cpu_count = 1;
    unsigned int guess     = 1;

    qthread_debug(AFFINITY_CALLS, "guessing workers for %i shepherds\n",
                  (int)nshepherds);
#ifdef HAVE_NUMA_NUM_THREAD_CPUS
    /* note: not numa_num_configured_cpus(), just in case an
     * artificial limit has been imposed. */
    cpu_count = numa_num_thread_cpus();
    qthread_debug(AFFINITY_DETAILS, "numa_num_thread_cpus returned %i\n",
                  nshepherds);
#elif defined(HAVE_NUMA_BITMASK_NBYTES)
    cpu_count = 0;
    for (size_t b = 0; b < numa_bitmask_nbytes(numa_all_cpus_ptr) * 8; b++) {
        cpu_count += numa_bitmask_isbitset(numa_all_cpus_ptr, b);
    }
    qthread_debug(AFFINITY_DETAILS,
                  "after checking through the all_cpus_ptr, I counted %i cpus\n",
                  (int)cpu_count);
#else  /* ifdef HAVE_NUMA_NUM_THREAD_CPUS */
    cpu_count = numa_max_node() + 1;
    qthread_debug(AFFINITY_DETAILS, "numa_max_node() returned %i\n", nshepherds);
#endif  /* ifdef HAVE_NUMA_NUM_THREAD_CPUS */
    guess = cpu_count / nshepherds;
    if (guess == 0) {
        guess = 1;
    }
    qthread_debug(AFFINITY_DETAILS, "guessing %i workers per shepherd\n",
                  (int)guess);
    return guess;
}                                      /*}}} */
コード例 #2
0
ファイル: tasks-qthreads.c プロジェクト: nspark/qthreads
// Start the main task.
//
// Warning: this method is not called within a Qthread task context. Do
// not use methods that require task context (e.g., task-local storage).
void chpl_task_callMain(void (*chpl_main)(void))
{
    const chpl_bool initial_serial_state = false;
    const c_localeid_t initial_locale_id = default_locale_id;
    const chapel_wrapper_args_t wrapper_args = 
        {chpl_main, NULL, NULL, 0,
         {initial_serial_state, initial_locale_id, NULL,
          chpl_malloc, chpl_calloc, chpl_realloc, chpl_free}};

    qthread_debug(CHAPEL_CALLS, "[%d] begin chpl_task_callMain()\n", chpl_localeID);

    default_serial_state = initial_serial_state;

#ifdef QTHREAD_MULTINODE
    qthread_debug(CHAPEL_BEHAVIOR, "[%d] calling spr_unify\n", chpl_localeID);
    int const rc = spr_unify();
    assert(SPR_OK == rc);
#endif /* QTHREAD_MULTINODE */

    qthread_fork_syncvar(chapel_wrapper, &wrapper_args, &exit_ret);
    qthread_syncvar_readFF(NULL, &exit_ret);

    qthread_debug(CHAPEL_BEHAVIOR, "[%d] main task finished\n", chpl_localeID);
    qthread_debug(CHAPEL_CALLS, "[%d] end chpl_task_callMain()\n", chpl_localeID);
}
コード例 #3
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// This call specifies the number of polling tasks that the
// communication layer will need (see just below for a definition).
// The value it returns is passed to chpl_task_init(), in order to
// forewarn the tasking layer whether the comm layer will need a
// polling task.  In the current implementation, it should only
// return 0 or 1.
//
int chpl_comm_numPollingTasks(void)
{
    qthread_debug(CHAPEL_CALLS, "[%d] begin\n", chpl_localeID);
    qthread_debug(CHAPEL_CALLS, "[%d] end\n", chpl_localeID);

    return 1;
}
コード例 #4
0
ファイル: no.c プロジェクト: deniskin82/chapel
qthread_worker_id_t INTERNAL guess_num_workers_per_shep(qthread_shepherd_id_t nshepherds)
{                                      /*{{{ */
    size_t num_procs = 1;
    size_t guess     = 1;

    qthread_debug(AFFINITY_CALLS, "guessing workers for %i shepherds\n",
                  (int)nshepherds);
#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF)      /* Linux */
    long ret = sysconf(_SC_NPROCESSORS_CONF);
    qthread_debug(AFFINITY_DETAILS, "sysconf() says %i processors\n", (int)ret);
    num_procs = (ret > 0) ? (size_t)ret : 1;
#elif defined(HAVE_SYSCTL) && defined(CTL_HW) && defined(HW_NCPU)
    int      name[2] = { CTL_HW, HW_NCPU };
    uint32_t oldv;
    size_t   oldvlen = sizeof(oldv);
    if (sysctl(name, 2, &oldv, &oldvlen, NULL, 0) >= 0) {
        assert(oldvlen == sizeof(oldv));
        qthread_debug(AFFINITY_DETAILS, "sysctl() says %i CPUs\n", (int)oldv);
        num_procs = (size_t)oldv;
    }
#endif  /* if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF) */
    guess = num_procs / nshepherds;
    if (guess == 0) {
        guess = 1;
    }
    qthread_debug(AFFINITY_DETAILS, "guessing %i workers per shepherd\n",
                  (int)guess);
    return (qthread_shepherd_id_t)guess;
}                                      /*}}} */
コード例 #5
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// returns the maximum number of threads that can be handled
// by this communication layer (used to ensure numThreadsPerLocale is
// legal); should return the sentinel value of 0 if the communication
// layer imposes no particular limit on the number of threads.
//
int32_t chpl_comm_getMaxThreads(void)
{
    qthread_debug(CHAPEL_CALLS, "[%d] begin\n", chpl_localeID);
    qthread_debug(CHAPEL_CALLS, "[%d] end\n", chpl_localeID);

    return 0;
}
コード例 #6
0
ファイル: net.c プロジェクト: deniskin82/chapel
int qthread_fork_remote_sinc(qthread_f   f,
                             const void *arg,
                             qt_sinc_t  *ret,
                             int         rank,
                             size_t      arg_len)
{
    struct fork_msg_t msg;

    qthread_debug(MULTINODE_CALLS, "[%d] begin qthread_fork_remote_sinc(0x%lx, 0x%lx, 0x%lx, %d, %ld)\n",
                  my_rank, (unsigned long)f, (unsigned long)arg,
                  (unsigned long)ret, rank, arg_len);

    if (arg_len <= sizeof(msg.args)) {
        msg.uid = (uint64_t)qt_hash_get(ptr_to_uid_hash, f);
        if (qt_hash_get(uid_to_ptr_hash, (qt_key_t)(uintptr_t)msg.uid) != f) {
            fprintf(stderr, "action not registered at source\n");
            abort();
        }
        msg.return_addr = (uint64_t)ret;
        msg.origin_node = my_rank;
        msg.arg_len     = arg_len;
        memcpy(msg.args, arg, arg_len);
        qthread_debug(MULTINODE_DETAILS, "[%d] remote fork %d %d 0x%lx %d\n",
                      my_rank, rank, msg.uid, msg.return_addr, msg.arg_len);
        return qthread_internal_net_driver_send(rank, SHORT_MSG_SINC_TAG, &msg, sizeof(msg));
    }

    fprintf(stderr, "long remote fork unsupported\n");
    abort();
}
コード例 #7
0
ファイル: net.c プロジェクト: deniskin82/chapel
static aligned_t fork_helper(void *info)
{
    struct fork_msg_t *msg = (struct fork_msg_t *)info;
    aligned_t          ret;
    qthread_f          f;

    qthread_debug(MULTINODE_FUNCTIONS, "[%d] begin fork_helper\n", my_rank);

    f = qt_hash_get(uid_to_ptr_hash, (qt_key_t)(uintptr_t)msg->uid);
    if (NULL != f) {
        ret = f(msg->args);

        if (0 != msg->return_addr) {
            struct return_msg_t ret_msg;
            ret_msg.return_addr = msg->return_addr;
            ret_msg.return_val  = ret;
            qthread_debug(MULTINODE_DETAILS, "[%d] sending return msg 0x%lx, %ld\n",
                          my_rank, ret_msg.return_addr, ret_msg.return_val);
            qthread_internal_net_driver_send(msg->origin_node, RETURN_MSG_TAG,
                                             &ret_msg, sizeof(ret_msg));
        }
    } else {
        fprintf(stderr, "action uid %d not registered at destination\n", msg->uid);
        abort();
    }

    qthread_debug(MULTINODE_FUNCTIONS, "[%d] end fork_helper\n", my_rank);

    return 0;
}
コード例 #8
0
ファイル: no.c プロジェクト: deniskin82/chapel
qthread_shepherd_id_t INTERNAL guess_num_shepherds(void)
{                                                              /*{{{ */
#if defined(HAVE_SYSCONF) && defined(HAVE_SC_NPROCESSORS_CONF) /* Linux */
    long ret = sysconf(_SC_NPROCESSORS_CONF);
    qthread_debug(AFFINITY_CALLS, "based on sysconf(), guessing %i shepherds\n",
                  (int)ret);
    return (ret > 0) ? ret : 1;

#elif defined(HAVE_SYSCTL) && defined(HAVE_HW_NCPU)
    int      name[2] = { CTL_HW, HW_NCPU };
    uint32_t oldv;
    size_t   oldvlen = sizeof(oldv);
    if (sysctl(name, 2, &oldv, &oldvlen, NULL, 0) >= 0) {
        assert(oldvlen == sizeof(oldv));
        qthread_debug(AFFINITY_CALLS,
                      "based on sysctl(), guessing %i shepherds\n",
                      (int)oldv);
        return oldv;
    } else {
        qthread_debug(AFFINITY_CALLS,
                      "sysctl() returned an error, assuming 1 shepherd\n");
        return 1;
    }
#endif /* if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF) */
    qthread_debug(AFFINITY_CALLS,
                  "no useful interfaces present; assuming a single shepherd\n");
    return 1;
}                                      /*}}} */
コード例 #9
0
ファイル: envariables.c プロジェクト: Agobin/chapel
unsigned long INTERNAL qt_internal_get_env_num(const char   *envariable,
                                               unsigned long dflt,
                                               unsigned long zerodflt)
{
    const char   *str;
    unsigned long tmp = dflt;

    if (dflt != 0) {
        char dflt_str[10];

        snprintf(dflt_str, 10, "%lu", dflt);
        str = qt_internal_get_env_str(envariable, dflt_str);
    } else {
        str = qt_internal_get_env_str(envariable, NULL);
    }
    if (str && *str) {
        char *errptr;
        tmp = strtoul(str, &errptr, 0);
        if (*errptr != 0) {
            fprintf(stderr, "unparsable %s (%s)\n", envariable, str);
            tmp = dflt;
        }
        if (tmp == 0) {
            qthread_debug(CORE_DETAILS, "since envariable %s is 0, choosing default: %u\n", envariable, zerodflt);
            tmp = zerodflt;
        } else {
            qthread_debug(CORE_DETAILS, "envariable %s parsed as %u\n", envariable, tmp);
        }
    }
    return tmp;
}
コード例 #10
0
ファイル: net.c プロジェクト: deniskin82/chapel
int qthread_multinode_run(void)
{
    aligned_t val;

    if (0 == initialized) { return 1; }

    qthread_debug(MULTINODE_CALLS, "[%d] begin qthread_multinode_run\n", my_rank);

    qthread_internal_net_driver_barrier();

    if (0 != my_rank) {
        struct die_msg_t msg;

        qthread_readFE(&val, &time_to_die);
        qthread_debug(MULTINODE_DETAILS, "[%d] time to die\n", my_rank);
        msg.my_rank = my_rank;
        qthread_internal_net_driver_send(0, DIE_MSG_TAG, &msg, sizeof(msg));
        qthread_finalize();
        exit(0);
    }

    qthread_debug(MULTINODE_CALLS, "[%d] end qthread_multinode_run\n", my_rank);

    return QTHREAD_SUCCESS;
}
コード例 #11
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
static inline void spawn(int locale, chpl_fn_int_t fid, void *arg, 
                                int32_t arg_size, int32_t arg_tid, aligned_t *ret)
{
    qthread_debug(CHAPEL_CALLS, "[%d] begin: locale=%d, fid=%d, arg_size=%d\n", chpl_localeID, locale, fid, arg_size);

        spawn_wrapper_args_t *wargs;
    size_t const wargs_size = sizeof(spawn_wrapper_args_t) + arg_size;

    wargs = (spawn_wrapper_args_t *)chpl_mem_allocMany(1, wargs_size, CHPL_RT_MD_COMM_FORK_SEND_INFO, 0, 0);
        wargs->serial_state = chpl_task_getSerial();
    wargs->fid = fid;
    wargs->arg_size = arg_size;
    memcpy(&(wargs->arg), arg, arg_size);

    if (chpl_localeID == locale) {
        int const rc = qthread_fork_copyargs(spawn_wrapper, wargs, wargs_size, ret);
        assert(QTHREAD_SUCCESS == rc);
    } else {
        int const rc = qthread_fork_remote(spawn_wrapper, wargs, ret, locale, wargs_size);
        assert(SPR_OK == rc);
    }

    chpl_mem_free(wargs, 0, NULL);

    qthread_debug(CHAPEL_CALLS, "[%d] end: locale=%d, fid=%d, arg_size=%d\n", chpl_localeID, locale, fid, arg_size);
}
コード例 #12
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// Broadcast the value of 'id'th entry in chpl_private_broadcast_table
// on the calling locale onto every other locale.  This is done to set
// up global constants of simple scalar types (primarily).
//
void chpl_comm_broadcast_private(int id, int32_t size, int32_t tid)
{
    int i;
    bcast_private_args_t *payload;

    PROFILE_INCR(profile_comm_broadcast_private,1);

    qthread_debug(CHAPEL_CALLS, "[%d] begin id=%d, size=%d, tid=%d\n", chpl_localeID, id, size, tid);

    payload = chpl_mem_allocMany(1, sizeof(bcast_private_args_t) + size, 
                                 CHPL_RT_MD_COMM_PRIVATE_BROADCAST_DATA, 0, 0);
    payload->id = id;
    payload->size = size;
    memcpy(payload->data, chpl_private_broadcast_table[id], size);

    qthread_debug(CHAPEL_DETAILS, "[%d] payload={.id=%d; .size=%d; .data=?}\n", chpl_localeID, payload->id, payload->size);

    aligned_t rets[chpl_numLocales];
    for (i = 0; i < chpl_numLocales; i++) {
        if (i != chpl_localeID) {
            qthread_fork_remote(bcast_private, payload, &rets[i], i,
                                sizeof(bcast_private_args_t) + size);
        }
    }
    for (i = 0; i < chpl_numLocales; i++) {
        if (i != chpl_localeID) {
            qthread_readFF(&rets[i], &rets[i]);
        }
    }

    chpl_mem_free(payload,0,0);

    qthread_debug(CHAPEL_CALLS, "[%d] end id=%d, size=%d, tid=%d\n", chpl_localeID, id, size, tid);
}
コード例 #13
0
static int qt_lf_list_delete(marked_ptr_t        *head,
                             so_key_t             hashed_key,
                             qt_key_t             key,
                             qt_dict_key_equals_f op_equals,
                             qt_dict_cleanup_f    cleanup)
{
    while (1) {
        marked_ptr_t *lprev;
        marked_ptr_t  lcur;
        marked_ptr_t  lnext;
        if (qt_lf_list_find(head, hashed_key, key, &lprev, &lcur, &lnext, op_equals) == NULL) {
            qthread_debug(ALWAYS_OUTPUT, "### inside delete - return 0\n");
            return 0;
        }
        if (qthread_cas_ptr(&PTR_OF(lcur)->next, (void*)CONSTRUCT(0, lnext), (void*)CONSTRUCT(1, lnext)) != (void *)CONSTRUCT(0, lnext)) {
            qthread_debug(ALWAYS_OUTPUT, "### inside delete - cas failed continue\n");
            continue;
        }
        if (qthread_cas(lprev, CONSTRUCT(0, lcur), CONSTRUCT(0, lnext)) == CONSTRUCT(0, lcur)) {
            if (cleanup != NULL) {
                cleanup(PTR_OF(lcur)->key, NULL);
            }
            qpool_free(hash_entry_pool, PTR_OF(lcur));
        } else {
            qt_lf_list_find(head, hashed_key, key, NULL, NULL, NULL, op_equals);                                   // needs to set cur/prev/next
        }
        return 1;
    }
}
コード例 #14
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// if possible, run in gdb (because the user threw the --gdb flag)
// using argc and argv.  gdbArgnum gives the index of the argv[]
// element containing the --gdb flag.  Return the status of that
// process in "status" and return 1 if it was possible to run in gdb,
// 0 otherwise
//
int32_t chpl_comm_run_in_gdb(int argc, char * argv[],
                             int gdbArgnum, int * status)
{
    qthread_debug(CHAPEL_CALLS, "[%d] begin\n", chpl_localeID);
    qthread_debug(CHAPEL_CALLS, "[%d] end\n", chpl_localeID);

    return 0;
}
コード例 #15
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// Segment info table setup helper - based on GASnet implementation
//
void chpl_comm_spr_help_register_global_var(int i, void * addr) {
    qthread_debug(CHAPEL_CALLS, "[%d] begin\n", chpl_localeID);

    if (chpl_localeID == 0) {
        ((void **)seginfo_table[0].addr)[i] = addr;
    }

    qthread_debug(CHAPEL_CALLS, "[%d] end\n", chpl_localeID);
}
コード例 #16
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
void chpl_comm_barrier(const char *msg)
{
    qthread_debug(CHAPEL_CALLS, "[%d] begin: %s\n", chpl_localeID, msg);
    PROFILE_INCR(profile_comm_barrier,1);

    spr_locale_barrier();

    qthread_debug(CHAPEL_CALLS, "[%d] end: %s\n", chpl_localeID, msg);
}
コード例 #17
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// allocate chpl_globals_registry or make it point to
// chpl_globals_registry_static depending on the communication layer
//
void chpl_comm_alloc_registry(int numGlobals)
{
    qthread_debug(CHAPEL_CALLS, "[%d] begin\n", chpl_localeID);

    // Use the statically allocate array defined in generated C code.
    chpl_globals_registry = chpl_globals_registry_static;

    qthread_debug(CHAPEL_CALLS, "[%d] end\n", chpl_localeID);
}
コード例 #18
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// Inform callers as to the communication layer's desired starting address
// and length for the shared heap, if any.
//
void chpl_comm_desired_shared_heap(void** start_p, size_t* size_p)
{
    qthread_debug(CHAPEL_CALLS, "[%d] begin\n", chpl_localeID);

    *start_p = NULL;
    *size_p  = 0;

    qthread_debug(CHAPEL_CALLS, "[%d] end\n", chpl_localeID);
}
コード例 #19
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// a final comm layer stub before barrier synching and calling into
// the user code.  It is recommended that a debugging message be
// printed here indicating that each locale has started using
// chpl_msg() and a verbosity level of 2 (which will cause it to be
// displayed using the -v flag).
//
// Cannot call spr_unify() here because there is a barrier afterwards.
void chpl_comm_rollcall(void)
{
    qthread_debug(CHAPEL_CALLS, "[%d] begin\n", chpl_localeID);

    chpl_msg(2, "executing on locale %d of %d locale(s): %s\n", chpl_localeID,
             chpl_numLocales, chpl_localeName());

    qthread_debug(CHAPEL_CALLS, "[%d] end\n", chpl_localeID);
}
コード例 #20
0
ファイル: net.c プロジェクト: Agobin/chapel
static void fork_long_msg_handler(int    tag,
                                  void  *start,
                                  size_t len)
{
    qthread_debug(MULTINODE_FUNCTIONS, "[%d] begin fork_long_msg_handler\n", my_rank);

    qthread_fork_copyargs(fork_long_helper, start, len, NULL);

    qthread_debug(MULTINODE_FUNCTIONS, "[%d] end fork_long_msg_handler\n", my_rank);
}
コード例 #21
0
ファイル: net.c プロジェクト: Agobin/chapel
int qthread_fork_remote(qthread_f   f,
                        const void *arg,
                        aligned_t  *ret,
                        int         rank,
                        size_t      arg_len)
{
    qthread_debug(MULTINODE_CALLS, "[%d] begin f=0x%lx, arg=0x%lx, ret=0x%lx, rank=%d, arg_len=%ld)\n",
                  my_rank, (unsigned long)f, (unsigned long)arg,
                  (unsigned long)ret, rank, arg_len);

    uint64_t const uid = (uint64_t)qt_hash_get(ptr_to_uid_hash, f);
    if (qt_hash_get(uid_to_ptr_hash, (qt_key_t)(uintptr_t)uid) != f) {
        fprintf(stderr, "action not registered at source\n");
        abort();
    }

    if (NULL != ret) {
        qthread_empty(ret);
    }

    if (arg_len <= FORK_MSG_PAYLOAD) {
        struct fork_msg_t msg;

        msg.uid         = uid;
        msg.return_addr = (uint64_t)ret;
        msg.origin_node = my_rank;
        msg.arg_len     = arg_len;
        memcpy(msg.args, arg, arg_len);
        qthread_debug(MULTINODE_DETAILS, "[%d] remote fork %d %d 0x%lx %d\n",
                      my_rank, rank, msg.uid, msg.return_addr, msg.arg_len);
        return qthread_internal_net_driver_send(rank, SHORT_MSG_TAG, &msg, sizeof(msg));
    } else {

        struct fork_long_msg_t * long_msg;

        size_t long_msg_size = sizeof(struct fork_long_msg_t) + arg_len;
        long_msg = malloc(long_msg_size);
        assert(NULL != long_msg);

        long_msg->uid         = uid;
        long_msg->return_addr = (uint64_t)ret;
        long_msg->origin_node = my_rank;
        long_msg->arg_len     = arg_len;
        memcpy(&long_msg->args, arg, arg_len);

        qthread_debug(MULTINODE_DETAILS, "[%d] remote long fork rank=%d uid=%d return_addr=0x%lx arg_len=%d\n",
                      my_rank, rank, long_msg->uid, long_msg->return_addr, long_msg->arg_len);
        int const rc = qthread_internal_net_driver_send(rank, LONG_MSG_TAG, long_msg, long_msg_size);

        free(long_msg);

        return rc;
    }
}
コード例 #22
0
ファイル: net.c プロジェクト: deniskin82/chapel
static void fork_msg_sinc_handler(int    tag,
                                  void  *start,
                                  size_t len)
{
    qthread_debug(MULTINODE_FUNCTIONS, "[%d] begin fork_msg_sinc_handler\n", my_rank);

    if (sizeof(struct fork_msg_t) > len) { abort(); }

    qthread_fork_copyargs(fork_sinc_helper, start, len, NULL);

    qthread_debug(MULTINODE_FUNCTIONS, "[%d] end fork_msg_sinc_handler\n", my_rank);
}
コード例 #23
0
ファイル: net.c プロジェクト: deniskin82/chapel
int qthread_multinode_multistart(void)
{
    if (0 == initialized) { return 1; }

    qthread_debug(MULTINODE_CALLS, "[%d] begin qthread_multinode_multistart\n", my_rank);

    qthread_internal_net_driver_barrier();

    qthread_debug(MULTINODE_CALLS, "[%d] end qthread_multinode_multistart\n", my_rank);

    return QTHREAD_SUCCESS;
}
コード例 #24
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// non-blocking fork
//
void chpl_comm_fork_nb(int locale, chpl_fn_int_t fid,
                       void *arg, int32_t arg_size, int32_t arg_tid)
{
    PROFILE_INCR(profile_comm_fork_nb,1);
    PROFILE_BIN_INCR(profile_comm_fork_nb_size,arg_size);

    qthread_debug(CHAPEL_CALLS, "[%d] begin locale=%d, fid=%d, arg_size=%d\n", chpl_localeID, locale, fid, arg_size);
    qthread_debug(CHAPEL_BEHAVIOR, "[%d] (non-blocking) forking fn %d with arg-size %d\n", chpl_localeID, fid, arg_size);

    spawn(locale, fid, arg, arg_size, arg_tid, NULL);

    qthread_debug(CHAPEL_CALLS, "[%d] end locale=%d, fid=%d, arg_size=%d\n", chpl_localeID, locale, fid, arg_size);
}
コード例 #25
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
//
// fast (non-forking) fork (i.e., run in handler)
//
// TODO: implement fast fork in progress thread
void chpl_comm_fork_fast(int locale, chpl_fn_int_t fid, void *arg,
                         int32_t arg_size, int32_t arg_tid)
{
    PROFILE_INCR(profile_comm_fork_fast,1);
    PROFILE_BIN_INCR(profile_comm_fork_fast_size,arg_size);

    qthread_debug(CHAPEL_CALLS, "[%d] begin locale=%d, fid=%d, arg_size=%d\n", chpl_localeID, locale, fid, arg_size);
    qthread_debug(CHAPEL_BEHAVIOR, "[%d] (fast) forking fn %d with arg-size %d\n", chpl_localeID, fid, arg_size);

    chpl_comm_fork(locale, fid, arg, arg_size, arg_tid);
    
    qthread_debug(CHAPEL_CALLS, "[%d] end locale=%d, fid=%d, arg_size=%d\n", chpl_localeID, locale, fid, arg_size);
}
コード例 #26
0
ファイル: net.c プロジェクト: deniskin82/chapel
static void return_msg_sinc_handler(int    tag,
                                    void  *start,
                                    size_t len)
{
    struct return_msg_t *msg = (struct return_msg_t *)start;

    qthread_debug(MULTINODE_FUNCTIONS, "[%d] begin return_msg_sinc_handler 0x%lx, %ld\n",
                  my_rank, (unsigned long)msg->return_addr, msg->return_val);

    qt_sinc_submit((qt_sinc_t *)msg->return_addr, NULL);

    qthread_debug(MULTINODE_FUNCTIONS, "[%d] end return_msg_sinc_handler\n",
                  my_rank);
}
コード例 #27
0
ファイル: net.c プロジェクト: deniskin82/chapel
static void die_msg_handler(int    tag,
                            void  *start,
                            size_t len)
{
    qthread_debug(MULTINODE_FUNCTIONS, "[%d] begin die_msg_handler\n", my_rank);

    if (my_rank == 0) {
        num_ended++;
    } else {
        qthread_writeF_const(&time_to_die, 1);
    }

    qthread_debug(MULTINODE_FUNCTIONS, "[%d] end die_msg_handler\n", my_rank);
}
コード例 #28
0
ファイル: comm-qthreads.c プロジェクト: Agobin/chapel
aligned_t bcast_seginfo(void *arg_)
{
    seginfo_t * buf = (seginfo_t *)arg_;

    assert(buf);
    assert(seginfo_table);

    qthread_debug(CHAPEL_DETAILS, "[%d] buf=%p buf[0].addr=%p, buf[0].size=%d\n", chpl_localeID, buf, buf[0].addr, buf[0].size);

    memcpy(seginfo_table, buf, chpl_numLocales * sizeof(seginfo_t));

    qthread_debug(CHAPEL_DETAILS, "[%d] seginfo_table=%p seginfo_table[0].addr=%p, seginfo_table[0].size=%d\n", chpl_localeID, seginfo_table, seginfo_table[0].addr, seginfo_table[0].size);

    return 0;
}
コード例 #29
0
ファイル: net.c プロジェクト: deniskin82/chapel
int qthread_multinode_register(uint32_t  uid,
                               qthread_f f)
{
    int ret = 0;

    if (0 == initialized) { return 1; }

    qthread_debug(MULTINODE_CALLS, "[%d] begin qthread_multinode_register(uid=%d, ptr=0x%lx)\n",
                  my_rank, uid, (unsigned long)f);

    // Check that UID is strictly positive
    if (0 == uid) {
        fprintf(stderr, "invalid action id %d: must be > 0", uid);
        return 1;
    }

    // Check that UID is not used more than once
    if (NULL != qt_hash_get(uid_to_ptr_hash, (qt_key_t)(uintptr_t)uid)) {
        fprintf(stderr, "duplicate registration of action uid %d\n", uid);
        return 1;
    }

    ret = qt_hash_put(uid_to_ptr_hash, (qt_key_t)(uintptr_t)uid, f);
    if (ret != 1) {
        qthread_debug(MULTINODE_DETAILS, "[%d] uid -> ptr registration failed\n",
                      my_rank);
        return 1;
    }

    // Check that function pointer is not used more than once
    if (NULL != qt_hash_get(ptr_to_uid_hash, f)) {
        fprintf(stderr, "duplicate registration of action function 0x%lx\n",
                (unsigned long)f);
        return 1;
    }

    ret = qt_hash_put(ptr_to_uid_hash, f, (void *)(uintptr_t)uid);
    if (ret != 1) {
        qthread_debug(MULTINODE_DETAILS, "[%d] ptr -> uid registration failed\n",
                      my_rank);
        return 1;
    }

    qthread_debug(MULTINODE_CALLS, "[%d] end qthread_multinode_register\n",
                  my_rank);

    return 0;
}
コード例 #30
0
ファイル: nemesis_threadqueues.c プロジェクト: DawidvC/chapel
static inline qt_threadqueue_node_t *qt_internal_NEMESIS_dequeue_st(NEMESIS_queue *q)
{                                      /*{{{ */
    if (!q->shadow_head) {
        if (!q->head) {
            return NULL;
        }
        q->shadow_head = q->head;
        q->head        = NULL;
    }

    qt_threadqueue_node_t *const retval = (void *volatile)(q->shadow_head);

    if ((retval != NULL) && (retval != (void *)1)) {
        if (retval->next != NULL) {
            q->shadow_head = retval->next;
            retval->next   = NULL;
        } else {
            qt_threadqueue_node_t *old;
            q->shadow_head = NULL;
            if (q->tail == retval) {
                q->tail = NULL;
            }
        }
    }
    qthread_debug(THREADQUEUE_DETAILS, "nemesis q:%p head:%p tail:%p shadow_head:%p\n", q, q->head, q->tail, q->shadow_head);
    return retval;
}                                      /*}}} */