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

SCM Repository

[diderot] Annotation of /branches/vis12/src/compiler/c-target/fragments/par-hdr.in
ViewVC logotype

Annotation of /branches/vis12/src/compiler/c-target/fragments/par-hdr.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1826 - (view) (download)

1 : jhr 1826 /*! \file @CFILE@
2 :     *
3 :     * Generated from @SRCFILE@.
4 :     */
5 :    
6 :     /*
7 :     * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
8 :     * All rights reserved.
9 :     */
10 :    
11 :     #include "@HDRFILE@"
12 :     #include "Diderot/diderot.h"
13 :     #include <pthread.h>
14 :    
15 :     static char *ProgramName = "@SRCFILE@";
16 :    
17 :     typedef struct @PREFIX@struct_@STRAND@ Strand_@STRAND@_t;
18 :    
19 :     // The number of strands a worker will take for processing at one time
20 :     #define BLOCK_SIZE 4096
21 :    
22 :     // cache-line alignment (Xeon has 64-byte lines)
23 :     #define CACHE_ALIGN __attribute__((aligned(64)))
24 :    
25 :     // argument struct for worker threads
26 :     typedef struct {
27 :     uint32_t id; // worker's index into worker array
28 :     uint32_t maxNSteps // maximum number of steps to take; 0 == infinity
29 :     @PREFIX@World_t *wrld; // pointer to world structure
30 :     } WorkerArg_t CACHE_ALIGN;
31 :    
32 :     // Scheduler state
33 :     typedef struct {
34 :     uint32_t numWorkers; // number of worker threads to use
35 :     uint32_t nextStrand CACHE_ALIGN; // index of next strand to update
36 :     uint32_t numActive CACHE_ALIGN; // # active strands
37 :     uint32_t numAvail CACHE_ALIGN; // # unevaluated strands
38 :     uint32_t numIdle CACHE_ALIGN; // # idle workers
39 :     pthread_mutex_t lock; // big lock to protect wrld from multiple accesses
40 :     pthread_cond_t barrier; // workers wait on this when they have no work
41 :     pthread_cond_t runWait; // used to signal @PREFIX@Run that the workers have finished
42 :     } Diderot_Sched_t;

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0