diff VCilk.h @ 0:b456b67cddd0

Initial add -- works, with vmalloc + probes version of VMS
author Me
date Sat, 30 Oct 2010 20:51:40 -0700
parents
children 2845dca6a28b
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/VCilk.h	Sat Oct 30 20:51:40 2010 -0700
     1.3 @@ -0,0 +1,121 @@
     1.4 +/*
     1.5 + *  Copyright 2009 OpenSourceStewardshipFoundation.org
     1.6 + *  Licensed under GNU General Public License version 2
     1.7 + *
     1.8 + * Author: seanhalle@yahoo.com
     1.9 + *
    1.10 + */
    1.11 +
    1.12 +#ifndef _VCilk_H
    1.13 +#define	_VCilk_H
    1.14 +
    1.15 +#include "VMS/Queue_impl/PrivateQueue.h"
    1.16 +#include "VMS/Hash_impl/PrivateHash.h"
    1.17 +#include "VMS/VMS.h"
    1.18 +
    1.19 +/*This header defines everything specific to the VCilk semantic plug-in
    1.20 + */
    1.21 +typedef struct _VCilkSemReq   VCilkSemReq;
    1.22 +
    1.23 +
    1.24 +/*Semantic layer-specific data sent inside a request from lib called in app
    1.25 + * to request handler called in MasterLoop
    1.26 + */
    1.27 +enum VCilkReqType
    1.28 + {
    1.29 +   syncReq = 1,
    1.30 +   mallocReq,
    1.31 +   freeReq
    1.32 + };
    1.33 +
    1.34 +struct _VCilkSemReq
    1.35 + { enum VCilkReqType    reqType;
    1.36 +   VirtProcr           *requestingPr;
    1.37 +   int32                sizeToMalloc;
    1.38 +   void                *ptrToFree;
    1.39 +   VirtProcrFnPtr       fnPtr;
    1.40 +   void                *initData;
    1.41 +   int32                coreToSpawnOnto;
    1.42 + }
    1.43 +/* VCilkSemReq */;
    1.44 +
    1.45 +typedef struct
    1.46 + {
    1.47 +   PrivQueueStruc **readyVPQs;
    1.48 +   HashTable       *commHashTbl;
    1.49 +   int32            numVirtPr;
    1.50 +   int32            nextCoreToGetNewPr;
    1.51 +   int32            primitiveStartTime;
    1.52 + }
    1.53 +VCilkSemEnv;
    1.54 +
    1.55 +typedef struct
    1.56 + {
    1.57 +   int32 syncPending;
    1.58 +   int32 numLiveChildren;
    1.59 +   VirtProcr *parentPr;
    1.60 + }
    1.61 +VCilkSemData;
    1.62 +
    1.63 +//===========================================================================
    1.64 +
    1.65 +void
    1.66 +VCilk__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
    1.67 +
    1.68 +int32
    1.69 +VCilk__giveMinWorkUnitCycles( float32 percentOverhead );
    1.70 +
    1.71 +void inline
    1.72 +VCilk__start_primitive();
    1.73 +
    1.74 +int32 inline
    1.75 +VCilk__end_primitive_and_give_cycles();
    1.76 +
    1.77 +int32
    1.78 +VCilk__giveIdealNumWorkUnits();
    1.79 +
    1.80 +//=======================
    1.81 +
    1.82 +void
    1.83 +VCilk__init();
    1.84 +
    1.85 +void
    1.86 +VCilk__cleanup_after_shutdown();
    1.87 +
    1.88 +//=======================
    1.89 +
    1.90 +void inline
    1.91 +VCilk__spawn( int32  coreToSpawnOnto, VirtProcrFnPtr  fnPtr,
    1.92 +              void  *initData,        VirtProcr      *creatingPr );
    1.93 +
    1.94 +int32
    1.95 +VCilk__give_number_of_cores_to_spawn_onto();
    1.96 +
    1.97 +void
    1.98 +VCilk__sync( VirtProcr *animatingPr );
    1.99 +
   1.100 +void *
   1.101 +VCilk__malloc( int32 sizeToMalloc, VirtProcr *animPr );
   1.102 +
   1.103 +void
   1.104 +VCilk__free( void *ptrToFree, VirtProcr *animPr );
   1.105 +
   1.106 +void
   1.107 +VCilk__dissipate_procr( VirtProcr *procrToDissipate );
   1.108 +
   1.109 +//=======================
   1.110 +
   1.111 +void
   1.112 +VCilk__free_semantic_request( VCilkSemReq *semReq );
   1.113 +
   1.114 +
   1.115 +//=========================  Internal use only  =============================
   1.116 +void
   1.117 +VCilk__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
   1.118 +
   1.119 +VirtProcr *
   1.120 +VCilk__schedule_virt_procr( void *_semEnv, int coreNum );
   1.121 +
   1.122 +
   1.123 +#endif	/* _VCilk_H */
   1.124 +