Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis15/src/lib/include/diderot/parallel.hxx
ViewVC logotype

View of /branches/vis15/src/lib/include/diderot/parallel.hxx

Parent Directory Parent Directory | Revision Log Revision Log

Revision 4351 - (download) (as text) (annotate)
Wed Aug 3 01:15:46 2016 UTC (3 years, 3 months ago) by jhr
File size: 2606 byte(s)
  Working on merge: spatial query support
/*! \file parallel.hxx
 * \author John Reppy

 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.


#  error "parallel.hxx included but target is not parallel"

#include "base.hxx"
#include "world.hxx"

#include <pthread.h>

namespace diderot {

// cach-line size (default Xeon has 64-byte lines)
#define CACHE_LINE_SIZE         64

// cache-line alignment
#define CACHE_ALIGN     __attribute__((aligned(CACHE_LINE_SIZE)))

    struct scheduler {
                                            // information about the available CPUs
        int             _numHWNodes;            //!< \brief number of (possibly multicore) processors
        int             _numHWCores;            //!< \brief total number of (possibly
                                                //!  mulithreaded) cores
        int             _numHWThreads;          //!< \brief total number of hardware threads
        int             _numCoresPerNode;       //!< \brief number of cores per thread
        int             _numThdsPerCore;        //!< \brief number of threads per core
        uint32_t        _numWorkers;            //!< number of worker threads to use
        uint32_t        _workSize;              //!< size of a block of work
        uint32_t        _nextStrand CACHE_ALIGN;//!< index of next strand to update
        uint32_t        _nactive CACHE_ALIGN;   //!< # active strands
        uint32_t        _nstable CACHE_ALIGN;   //!< # stable strands
        uint32_t        _navail CACHE_ALIGN;    //!< # unevaluated strands
        uint32_t        _nidle CACHE_ALIGN;     //!< # idle workers
        uint32_t        _nsteps CACHE_ALIGN;    //!< # of steps taken
        pthread_mutex_t _lock;                  //!< big lock to protect wrld from multiple accesses
        pthread_cond_t  _barrier;               //!< workers wait on this when they have no work
        pthread_cond_t  _runWait;               //!< used to signal run that the workers
                                                //!  have finished

        scheduler ();
        ~scheduler ();

      //! \brief get information about the host CPU configuration
      //! \return true if there is an error
        bool get_cpu_info (world_base *wrld);


} // namespace diderot


ViewVC Help
Powered by ViewVC 1.0.0