本文整理汇总了C++中InitTimers函数的典型用法代码示例。如果您正苦于以下问题:C++ InitTimers函数的具体用法?C++ InitTimers怎么用?C++ InitTimers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InitTimers函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
void main()
{
InitSystemClock();
InitPortsIO();
InitTimers();
EnableInterrupts();
while (1)
{
GENSendPacketIR(0x00,0xF7,0x20,0xDF); //Led "Game"
GENDelay100Us(500);
GENSendPacketIR(0x00,0xF7,0xA0,0x5E); //Led "TV"
GENDelay100Us(500);
GENSendPacketIR(0x00,0xFC,0xA1,0x5E); //Led "DVD"
GENDelay100Us(500);
/*GENSendPacketIR(0x03,0xFC,0x51,0xAE); //Led "CD/MP3"
GENDelay100Us(500);
GENSendPacketIR(0x03,0xFC,0x11,0xEE); //Led "Game"
GENDelay100Us(500);
GENSendPacketIR(0x03,0xFC,0xB1,0x4E); //Led "TV"
GENDelay100Us(500);
GENSendPacketIR(0x03,0xFC,0xA1,0x5E); //Led "DVD"
GENDelay100Us(500);
GENSendPacketIR(0x03,0xFC,0xB1,0x4E); //Led "TV"
GENDelay100Us(500);
GENSendPacketIR(0x03,0xFC,0x11,0xEE); //Led "Game"
GENDelay100Us(500); */
}
}
开发者ID:edosedgar,项目名称:stm8s,代码行数:28,代码来源:main.c
示例2: ParMETIS_V3_PartGeom
/***********************************************************************************
* This function is the entry point of the parallel ordering algorithm.
* This function assumes that the graph is already nice partitioned among the
* processors and then proceeds to perform recursive bisection.
************************************************************************************/
void ParMETIS_V3_PartGeom(idxtype *vtxdist, int *ndims, float *xyz, idxtype *part, MPI_Comm *comm)
{
int i, npes, mype, nvtxs, firstvtx, dbglvl;
idxtype *xadj, *adjncy;
CtrlType ctrl;
WorkSpaceType wspace;
GraphType *graph;
int zeroflg = 0;
MPI_Comm_size(*comm, &npes);
MPI_Comm_rank(*comm, &mype);
if (npes == 1) {
idxset(vtxdist[mype+1]-vtxdist[mype], 0, part);
return;
}
/* Setup a fake graph to allow the rest of the code to work unchanged */
dbglvl = 0;
nvtxs = vtxdist[mype+1]-vtxdist[mype];
firstvtx = vtxdist[mype];
xadj = idxmalloc(nvtxs+1, "ParMETIS_PartGeom: xadj");
adjncy = idxmalloc(nvtxs, "ParMETIS_PartGeom: adjncy");
for (i=0; i<nvtxs; i++) {
xadj[i] = i;
adjncy[i] = firstvtx + (i+1)%nvtxs;
}
xadj[nvtxs] = nvtxs;
/* Proceed with the rest of the code */
SetUpCtrl(&ctrl, npes, dbglvl, *comm);
ctrl.seed = mype;
ctrl.CoarsenTo = amin(vtxdist[npes]+1, 25*npes);
graph = Moc_SetUpGraph(&ctrl, 1, vtxdist, xadj, NULL, adjncy, NULL, &zeroflg);
PreAllocateMemory(&ctrl, graph, &wspace);
/*=======================================================
* Compute the initial geometric partitioning
=======================================================*/
IFSET(ctrl.dbglvl, DBG_TIME, InitTimers(&ctrl));
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.TotalTmr));
Coordinate_Partition(&ctrl, graph, *ndims, xyz, 0, &wspace);
idxcopy(graph->nvtxs, graph->where, part);
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, stoptimer(ctrl.TotalTmr));
IFSET(ctrl.dbglvl, DBG_TIME, PrintTimingInfo(&ctrl));
FreeInitialGraphAndRemap(graph, 0);
FreeWSpace(&wspace);
FreeCtrl(&ctrl);
GKfree((void **)&xadj, (void **)&adjncy, LTERM);
}
开发者ID:KnoooW,项目名称:gpgpu-sim,代码行数:65,代码来源:gkmetis.c
示例3: METIS_WPartGraphRecursive
/*************************************************************************
* This function is the entry point for PWMETIS that accepts exact weights
* for the target partitions
**************************************************************************/
void METIS_WPartGraphRecursive(int *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt,
idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts,
floattype *tpwgts, int *options, int *edgecut, idxtype *part)
{
int i, j;
GraphType graph;
CtrlType ctrl;
floattype *mytpwgts;
if (*numflag == 1)
Change2CNumbering(*nvtxs, xadj, adjncy);
SetUpGraph(&graph, OP_PMETIS, *nvtxs, 1, xadj, adjncy, vwgt, adjwgt, *wgtflag);
if (options[0] == 0) { /* Use the default parameters */
ctrl.CType = PMETIS_CTYPE;
ctrl.IType = PMETIS_ITYPE;
ctrl.RType = PMETIS_RTYPE;
ctrl.dbglvl = PMETIS_DBGLVL;
}
else {
ctrl.CType = options[OPTION_CTYPE];
ctrl.IType = options[OPTION_ITYPE];
ctrl.RType = options[OPTION_RTYPE];
ctrl.dbglvl = options[OPTION_DBGLVL];
}
ctrl.optype = OP_PMETIS;
ctrl.CoarsenTo = 20;
ctrl.maxvwgt = 1.5*(idxsum(*nvtxs, graph.vwgt)/ctrl.CoarsenTo);
mytpwgts = fmalloc(*nparts, "PWMETIS: mytpwgts");
for (i=0; i<*nparts; i++)
mytpwgts[i] = tpwgts[i];
InitRandom(-1);
AllocateWorkSpace(&ctrl, &graph, *nparts);
IFSET(ctrl.dbglvl, DBG_TIME, InitTimers(&ctrl));
IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.TotalTmr));
*edgecut = MlevelRecursiveBisection(&ctrl, &graph, *nparts, part, mytpwgts, 1.000, 0);
IFSET(ctrl.dbglvl, DBG_TIME, stoptimer(ctrl.TotalTmr));
IFSET(ctrl.dbglvl, DBG_TIME, PrintTimers(&ctrl));
FreeWorkSpace(&ctrl, &graph);
free(mytpwgts);
if (*numflag == 1)
Change2FNumbering(*nvtxs, xadj, adjncy, part);
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:56,代码来源:pmetis.c
示例4: METIS_EdgeND
/*************************************************************************
* This function is the entry point for OEMETIS
**************************************************************************/
void METIS_EdgeND(int *nvtxs, idxtype *xadj, idxtype *adjncy, int *numflag, int *options,
idxtype *perm, idxtype *iperm)
{
int i, j;
GraphType graph;
CtrlType ctrl;
if (*numflag == 1)
Change2CNumbering(*nvtxs, xadj, adjncy);
SetUpGraph(&graph, OP_OEMETIS, *nvtxs, 1, xadj, adjncy, NULL, NULL, 0);
if (options[0] == 0) { /* Use the default parameters */
ctrl.CType = OEMETIS_CTYPE;
ctrl.IType = OEMETIS_ITYPE;
ctrl.RType = OEMETIS_RTYPE;
ctrl.dbglvl = OEMETIS_DBGLVL;
}
else {
ctrl.CType = options[OPTION_CTYPE];
ctrl.IType = options[OPTION_ITYPE];
ctrl.RType = options[OPTION_RTYPE];
ctrl.dbglvl = options[OPTION_DBGLVL];
}
ctrl.oflags = 0;
ctrl.pfactor = -1;
ctrl.nseps = 1;
ctrl.optype = OP_OEMETIS;
ctrl.CoarsenTo = 20;
ctrl.maxvwgt = 1.5*(idxsum(*nvtxs, graph.vwgt)/ctrl.CoarsenTo);
InitRandom(-1);
AllocateWorkSpace(&ctrl, &graph, 2);
IFSET(ctrl.dbglvl, DBG_TIME, InitTimers(&ctrl));
IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.TotalTmr));
MlevelNestedDissection(&ctrl, &graph, iperm, ORDER_UNBALANCE_FRACTION, *nvtxs);
IFSET(ctrl.dbglvl, DBG_TIME, stoptimer(ctrl.TotalTmr));
IFSET(ctrl.dbglvl, DBG_TIME, PrintTimers(&ctrl));
for (i=0; i<*nvtxs; i++)
perm[iperm[i]] = i;
FreeWorkSpace(&ctrl, &graph);
if (*numflag == 1)
Change2FNumberingOrder(*nvtxs, xadj, adjncy, perm, iperm);
}
开发者ID:iyer-arvind,项目名称:gmsh,代码行数:55,代码来源:ometis.c
示例5: MCUInit
/**
* @fn void MCUInit()
*
* @brief Sets the microcontroller to a predetermined state. Handles initialization
* for all categories of peripherals: Analog, Architecture, Communication,
* Data Converters, GPIO, LCD, Special Modules, Timers.
*
*/
void MCUInit()
{
#if defined(__MCU_MSP430_SERIES)
InitAnalog(); // Initialize the Analog modules
InitArchitecture(); // Initialize the Architecture modules
InitCommunication(); // Initialize the Communication modules
InitDataConverters(); // Initialize the Data Converter modules
InitGPIO(); // Initialize the GPIO modules
InitLCD(); // Initialize the LCD modules
InitSpecialModules(); // Initialize the Special modules
InitTimers(); // Initialize the Timers modules
#endif
}
开发者ID:botbench,项目名称:mspdev,代码行数:21,代码来源:MCUInterface.c
示例6: InitBoard
/*
* Initialize the board
* Timers, Communication, etc
* Note : Should only be called once at the begginning of the main
*/
void InitBoard(void)
{
// Initialize clock
SYSTEMConfigPerformance(GetSystemClock());
SYSTEMConfig(GetSystemClock(), SYS_CFG_PCACHE);
SYSTEMConfig(GetSystemClock(), SYS_CFG_PB_BUS);
SYSTEMConfigPB(GetSystemClock());
INTEnableSystemMultiVectoredInt();
//Disable JTAG port
DDPCONbits.JTAGEN = 0;
// Initialize LEDs
LED1_TRIS = 0;
LED2_TRIS = 0;
// Initialize Timers
InitTimers();
// Initialize CAN bus
CRX1_TRIS = 1;
CTX1_TRIS = 0;
netv_init_can_driver(GetBoardID(),CAN1);
// Initialize digital IOs as inputs
DIO_TRIS |= DIO_MASK;
// Initialize Relays (low)
RELAY1_TRIS = 0;
RELAY2_TRIS = 0;
RELAY1 = 0;
RELAY2 = 0;
// Initialize SPI pins as inputs
SPICLK_TRIS = 1;
SPISDO_TRIS = 1;
SPI_CS_TRIS = 1;
SPISDI_TRIS = 1;
//TODO: Init unused pins as inputs
// Read the board ID
m_unBoardId = (DIO_PORT & DIO_MASK) ^ DIO_MASK;
// Read the parameters previously saved in flash
loadDataFromMemory();
//Enables the core to handle any pending interrupt requests
asm volatile ("ei");
}
开发者ID:doumdi,项目名称:ProjetVUE_VUE32,代码行数:55,代码来源:Board.c
示例7: METIS_mCPartGraphKway
/*************************************************************************
* This function is the entry point for KWMETIS
**************************************************************************/
void METIS_mCPartGraphKway(int *nvtxs, int *ncon, idxtype *xadj, idxtype *adjncy,
idxtype *vwgt, idxtype *adjwgt, int *wgtflag, int *numflag,
int *nparts, floattype *rubvec, int *options, int *edgecut,
idxtype *part)
{
int i, j;
GraphType graph;
CtrlType ctrl;
if (*numflag == 1)
Change2CNumbering(*nvtxs, xadj, adjncy);
SetUpGraph(&graph, OP_KMETIS, *nvtxs, *ncon, xadj, adjncy, vwgt, adjwgt, *wgtflag);
if (options[0] == 0) { /* Use the default parameters */
ctrl.CType = McKMETIS_CTYPE;
ctrl.IType = McKMETIS_ITYPE;
ctrl.RType = McKMETIS_RTYPE;
ctrl.dbglvl = McKMETIS_DBGLVL;
}
else {
ctrl.CType = options[OPTION_CTYPE];
ctrl.IType = options[OPTION_ITYPE];
ctrl.RType = options[OPTION_RTYPE];
ctrl.dbglvl = options[OPTION_DBGLVL];
}
ctrl.optype = OP_KMETIS;
ctrl.CoarsenTo = amax((*nvtxs)/(20*log2Int(*nparts)), 30*(*nparts));
ctrl.nmaxvwgt = 1.5/(1.0*ctrl.CoarsenTo);
InitRandom(-1);
AllocateWorkSpace(&ctrl, &graph, *nparts);
IFSET(ctrl.dbglvl, DBG_TIME, InitTimers(&ctrl));
IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.TotalTmr));
ASSERT(CheckGraph(&graph));
*edgecut = MCMlevelKWayPartitioning(&ctrl, &graph, *nparts, part, rubvec);
IFSET(ctrl.dbglvl, DBG_TIME, stoptimer(ctrl.TotalTmr));
IFSET(ctrl.dbglvl, DBG_TIME, PrintTimers(&ctrl));
FreeWorkSpace(&ctrl, &graph);
if (*numflag == 1)
Change2FNumbering(*nvtxs, xadj, adjncy, part);
}
开发者ID:davidheryanto,项目名称:sc14,代码行数:52,代码来源:mkmetis.c
示例8: main
void main ()
{
// Initializing PIC16LF1827
InitPorts();
InitTimers();
InitInterrupts();
while(1)
{
}
}
开发者ID:humbleSeraph,项目名称:PIC16LF1827_Runway,代码行数:15,代码来源:Proto1_mplabx.c
示例9: main
/***********LED Blinky Example**********************************************************************/
int main()
{
LPC_GPIO0->FIODIR |= (1 << 22); // set P0.22 to output
LPC_GPIO0->FIOPIN &= ~(1 << 22); //and turn the LED off.
InitTimers(); //initialize the timer;
can_init(125000);
//CAN_Init(LPC_CAN2, 125000);
OLCB_NodeID *id = new OLCB_NodeID(1,2,3,4,5,6);
while(1)
{
LPC_GPIO0->FIOPIN ^= (1 << 22); // Toggle P1.29
delay(500);
}
return 0;
}
开发者ID:kphannan,项目名称:OpenLCB,代码行数:18,代码来源:main.cpp
示例10: METIS_WPartGraphKway2
/*************************************************************************
* This function is the entry point for KWMETIS with seed specification
* in options[7]
**************************************************************************/
void METIS_WPartGraphKway2(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt,
idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts,
float *tpwgts, idxtype *options, idxtype *edgecut, idxtype *part)
{
idxtype i, j;
GraphType graph;
CtrlType ctrl;
if (*numflag == 1)
Change2CNumbering(*nvtxs, xadj, adjncy);
SetUpGraph(&graph, OP_KMETIS, *nvtxs, 1, xadj, adjncy, vwgt, adjwgt, *wgtflag);
if (options[0] == 0) { /* Use the default parameters */
ctrl.CType = KMETIS_CTYPE;
ctrl.IType = KMETIS_ITYPE;
ctrl.RType = KMETIS_RTYPE;
ctrl.dbglvl = KMETIS_DBGLVL;
}
else {
ctrl.CType = options[OPTION_CTYPE];
ctrl.IType = options[OPTION_ITYPE];
ctrl.RType = options[OPTION_RTYPE];
ctrl.dbglvl = options[OPTION_DBGLVL];
}
ctrl.optype = OP_KMETIS;
ctrl.CoarsenTo = 20*(*nparts);
ctrl.maxvwgt = 1.5*((graph.vwgt ? idxsum(*nvtxs, graph.vwgt, 1) : (*nvtxs))/ctrl.CoarsenTo);
InitRandom(options[7]);
AllocateWorkSpace(&ctrl, &graph, *nparts);
IFSET(ctrl.dbglvl, DBG_TIME, InitTimers(&ctrl));
IFSET(ctrl.dbglvl, DBG_TIME, gk_startcputimer(ctrl.TotalTmr));
*edgecut = MlevelKWayPartitioning(&ctrl, &graph, *nparts, part, tpwgts, 1.03);
IFSET(ctrl.dbglvl, DBG_TIME, gk_stopcputimer(ctrl.TotalTmr));
IFSET(ctrl.dbglvl, DBG_TIME, PrintTimers(&ctrl));
FreeWorkSpace(&ctrl, &graph);
if (*numflag == 1)
Change2FNumbering(*nvtxs, xadj, adjncy, part);
}
开发者ID:educharlie,项目名称:HNA-Algorithm,代码行数:50,代码来源:parmetis.c
示例11: ClassicLadder_InitAllDatas
void ClassicLadder_InitAllDatas( void )
{
InitVars();
#ifdef OLD_TIMERS_MONOS_SUPPORT
InitTimers();
InitMonostables();
#endif
InitCounters();
InitTimersIEC();
InitArithmExpr();
InitRungs();
InitSections( );
#ifdef SEQUENTIAL_SUPPORT
InitSequential( );
#endif
InitSymbols( );
}
开发者ID:13788593535,项目名称:machinekit,代码行数:17,代码来源:arrays.c
示例12: ParMETIS_FusedElementGraph
/***********************************************************************************
* This function creates the fused-element-graph and returns the partition
************************************************************************************/
void ParMETIS_FusedElementGraph(idxtype *vtxdist, idxtype *xadj, realtype *vvol,
realtype *vsurf, idxtype *adjncy, idxtype *vwgt, realtype *adjwgt,
int *wgtflag, int *numflag, int *nparts, int *options,
idxtype *part, MPI_Comm *comm)
{
int npes, mype, nvtxs;
CtrlType ctrl;
WorkSpaceType wspace;
GraphType *graph;
MPI_Comm_size(*comm, &npes);
MPI_Comm_rank(*comm, &mype);
nvtxs = vtxdist[mype+1]-vtxdist[mype];
/* IFSET(options[OPTION_DBGLVL], DBG_TRACK, printf("%d ParMETIS_FEG npes=%d\n",mype, npes)); */
SetUpCtrl(&ctrl, *nparts, options, *comm);
ctrl.CoarsenTo = amin(vtxdist[npes]+1, 25*amax(npes, *nparts));
graph = SetUpGraph(&ctrl, vtxdist, xadj, vwgt, adjncy, adjwgt, *wgtflag);
graph->where = part;
PreAllocateMemory(&ctrl, graph, &wspace);
IFSET(ctrl.dbglvl, DBG_TIME, InitTimers(&ctrl));
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.TotalTmr));
CreateFusedElementGraph(&ctrl, graph, &wspace, numflag);
idxcopy(nvtxs, graph->where, part);
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, stoptimer(ctrl.TotalTmr));
if (((*wgtflag)&2) == 0)
IMfree((void**)&graph->vwgt, LTERM);
IMfree((void**)&graph->lperm, &graph->peind, &graph->pexadj, &graph->peadjncy,
&graph->peadjloc, &graph->recvptr, &graph->recvind, &graph->sendptr,
&graph->imap, &graph->sendind, &graph, LTERM);
FreeWSpace(&wspace);
FreeCtrl(&ctrl);
}
开发者ID:mrklein,项目名称:ParMGridGen,代码行数:48,代码来源:fused.c
示例13: SetOnClock
void CIA6526::DoInit() {
// initialize base class
Chip::DoInit();
// set function to call at each clock
SetOnClock((pfn)OnClock);
SetBusy();
// initialize components
Reset.Init("Reset", this);
Reset.SetOnHigh((pfn)OnReset);
Reset.SetOnLow((pfn)OnReset);
InitPorts();
InitTimers();
InitTOD();
InitSDR();
InitControl();
// reset components
OnReset();
};
开发者ID:TeeKay4711,项目名称:jsidplay2,代码行数:22,代码来源:CIA6526.cpp
示例14: InitHardware
//=========================================================================
//----- (00000C48) --------------------------------------------------------
__myevic__ void InitHardware()
{
SYS_UnlockReg();
// 32.768kHz external crystal
if ( dfStatus.x32off )
{
CLK_DisableXtalRC( CLK_PWRCTL_LXTEN_Msk );
}
else
{
SYS->GPF_MFPL &= ~(SYS_GPF_MFPL_PF0MFP_Msk|SYS_GPF_MFPL_PF1MFP_Msk);
SYS->GPF_MFPL |= (SYS_GPF_MFPL_PF0MFP_X32_OUT|SYS_GPF_MFPL_PF1MFP_X32_IN);
CLK_EnableXtalRC( CLK_PWRCTL_LXTEN_Msk );
CLK_WaitClockReady( CLK_STATUS_LXTSTB_Msk );
}
SetPWMClock();
SYS_LockReg();
#if (ENABLE_UART)
InitUART0();
#endif
InitGPIO();
if ( !PD3 )
{
gFlags.noclock = 1;
}
InitSPI0();
InitEADC();
InitPWM();
InitTimers();
InitUSB();
}
开发者ID:ClockSelect,项目名称:myevic,代码行数:41,代码来源:main.c
示例15: main
/*********************************************************************
* Function: main
*********************************************************************/
void main(void) {
u32 ResponseCount;
void *pExitCriticalArg;
u32 i; //loop variable
// initialize the EZ-Kit
ezInit(1);
// initialize the flag manager because the LEDs and buttons connect via flags
// Since callbacks are not being used memory does not to be given to the service
ezErrorCheck(adi_flag_Init(NULL, 0, &ResponseCount, NULL));
//***CODE SNIPPED****//
InitTimers();
while (1) {
//***CODE SNIPPED****//
}
} // END WHILE
开发者ID:1900zyh,项目名称:leetcode,代码行数:26,代码来源:code.c
示例16: METIS_PartGraphKway
int METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, idx_t *adjncy,
idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, idx_t *nparts,
real_t *tpwgts, real_t *ubvec, idx_t *options, idx_t *objval,
idx_t *part)
{
int sigrval=0, renumber=0;
graph_t *graph;
ctrl_t *ctrl;
/* set up malloc cleaning code and signal catchers */
if (!gk_malloc_init())
return METIS_ERROR_MEMORY;
gk_sigtrap();
if ((sigrval = gk_sigcatch()) != 0)
goto SIGTHROW;
/* set up the run parameters */
ctrl = SetupCtrl(METIS_OP_KMETIS, options, *ncon, *nparts, tpwgts, ubvec);
if (!ctrl) {
gk_siguntrap();
return METIS_ERROR_INPUT;
}
/* if required, change the numbering to 0 */
if (ctrl->numflag == 1) {
Change2CNumbering(*nvtxs, xadj, adjncy);
renumber = 1;
}
/* set up the graph */
graph = SetupGraph(ctrl, *nvtxs, *ncon, xadj, adjncy, vwgt, vsize, adjwgt);
/* set up multipliers for making balance computations easier */
SetupKWayBalMultipliers(ctrl, graph);
/* set various run parameters that depend on the graph */
if (ctrl->iptype == METIS_IPTYPE_METISRB) {
ctrl->CoarsenTo = gk_max((*nvtxs)/(40*gk_log2(*nparts)), 30*(*nparts));
ctrl->CoarsenTo = 10*(*nparts);
ctrl->nIparts = (ctrl->CoarsenTo == 30*(*nparts) ? 4 : 5);
}
else {
ctrl->CoarsenTo = 10*(*nparts);
ctrl->nIparts = 10;
}
/* take care contiguity requests for disconnected graphs */
if (ctrl->contig && !IsConnected(graph, 0))
gk_errexit(SIGERR, "METIS Error: A contiguous partition is requested for a non-contiguous input graph.\n");
/* allocate workspace memory */
AllocateWorkSpace(ctrl, graph);
/* start the partitioning */
IFSET(ctrl->dbglvl, METIS_DBG_TIME, InitTimers(ctrl));
IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_startwctimer(ctrl->TotalTmr));
*objval = MlevelKWayPartitioning(ctrl, graph, part);
IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_stopwctimer(ctrl->TotalTmr));
IFSET(ctrl->dbglvl, METIS_DBG_TIME, PrintTimers(ctrl));
/* clean up */
FreeCtrl(&ctrl);
SIGTHROW:
/* if required, change the numbering back to 1 */
if (renumber)
Change2FNumbering(*nvtxs, xadj, adjncy, part);
gk_siguntrap();
gk_malloc_cleanup(0);
return metis_rcode(sigrval);
}
开发者ID:GeospatialDaryl,项目名称:Metis_from_KarypisLab,代码行数:78,代码来源:kmetis.c
示例17: METIS_NodeND
int METIS_NodeND(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt,
idx_t *options, idx_t *perm, idx_t *iperm)
{
int sigrval=0, renumber=0;
idx_t i, ii, j, l, nnvtxs=0;
graph_t *graph=NULL;
ctrl_t *ctrl;
idx_t *cptr, *cind, *piperm;
int numflag = 0;
/* set up malloc cleaning code and signal catchers */
if (!gk_malloc_init())
return METIS_ERROR_MEMORY;
gk_sigtrap();
if ((sigrval = gk_sigcatch()) != 0)
goto SIGTHROW;
/* set up the run time parameters */
ctrl = SetupCtrl(METIS_OP_OMETIS, options, 1, 3, NULL, NULL);
if (!ctrl) {
gk_siguntrap();
return METIS_ERROR_INPUT;
}
/* if required, change the numbering to 0 */
if (ctrl->numflag == 1) {
Change2CNumbering(*nvtxs, xadj, adjncy);
renumber = 1;
}
IFSET(ctrl->dbglvl, METIS_DBG_TIME, InitTimers(ctrl));
IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_startcputimer(ctrl->TotalTmr));
/* prune the dense columns */
if (ctrl->pfactor > 0.0) {
piperm = imalloc(*nvtxs, "OMETIS: piperm");
graph = PruneGraph(ctrl, *nvtxs, xadj, adjncy, vwgt, piperm, ctrl->pfactor);
if (graph == NULL) {
/* if there was no prunning, cleanup the pfactor */
gk_free((void **)&piperm, LTERM);
ctrl->pfactor = 0.0;
}
else {
nnvtxs = graph->nvtxs;
ctrl->compress = 0; /* disable compression if prunning took place */
}
}
/* compress the graph; note that compression only happens if not prunning
has taken place. */
if (ctrl->compress) {
cptr = imalloc(*nvtxs+1, "OMETIS: cptr");
cind = imalloc(*nvtxs, "OMETIS: cind");
graph = CompressGraph(ctrl, *nvtxs, xadj, adjncy, vwgt, cptr, cind);
if (graph == NULL) {
/* if there was no compression, cleanup the compress flag */
gk_free((void **)&cptr, &cind, LTERM);
ctrl->compress = 0;
}
else {
nnvtxs = graph->nvtxs;
ctrl->cfactor = 1.0*(*nvtxs)/nnvtxs;
if (ctrl->cfactor > 1.5 && ctrl->nseps == 1)
ctrl->nseps = 2;
//ctrl->nseps = (idx_t)(ctrl->cfactor*ctrl->nseps);
}
}
/* if no prunning and no compression, setup the graph in the normal way. */
if (ctrl->pfactor == 0.0 && ctrl->compress == 0)
graph = SetupGraph(ctrl, *nvtxs, 1, xadj, adjncy, vwgt, NULL, NULL);
ASSERT(CheckGraph(graph, ctrl->numflag, 1));
/* allocate workspace memory */
AllocateWorkSpace(ctrl, graph);
/* do the nested dissection ordering */
if (ctrl->ccorder)
MlevelNestedDissectionCC(ctrl, graph, iperm, graph->nvtxs);
else
MlevelNestedDissection(ctrl, graph, iperm, graph->nvtxs);
if (ctrl->pfactor > 0.0) { /* Order any prunned vertices */
icopy(nnvtxs, iperm, perm); /* Use perm as an auxiliary array */
for (i=0; i<nnvtxs; i++)
iperm[piperm[i]] = perm[i];
for (i=nnvtxs; i<*nvtxs; i++)
iperm[piperm[i]] = i;
gk_free((void **)&piperm, LTERM);
}
else if (ctrl->compress) { /* Uncompress the ordering */
/* construct perm from iperm */
//.........这里部分代码省略.........
开发者ID:arbenson,项目名称:Clique,代码行数:101,代码来源:ometis.c
示例18: main
//-------------------------------------------------------------------
//----------------------------Code-----------------------------------
//-------------------------------------------------------------------
void main(void)
{
// should only execute main loop once; after this just respond to interrupts
InitTimers();
InitPorts();
InitComm();
InitInterrupts();
SSPBUF = BytesOut[i];
while(1)
{
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
//-----EUART STUFF-------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
if(CommActive)
{
if( X_Transition!=0 )
{
X_Transition = 0;
switch( CurrentX_State )
{
case X_Idle_State :
{
SEND = 1;
NextX_State = X_StartDelim_State;
NextByteOut = 0x7E;
// Starting Edit for Variable Message Size
MessageCounter = Encode_Message(CurrentType);
X_LengthLSB = MessageCounter + 5; //For framing bytes
// Populating the Message Frame
X_CMD = TXData[0];
X_RF1 = TXData[1];
X_RF2 = TXData[2];
X_RF3 = TXData[3];
X_RF4 = TXData[4];
X_RF5 = TXData[5];
}
break;
case X_StartDelim_State :
{
NextX_State = X_LengthMSB_State;
NextByteOut = X_LengthMSB ;
}
break;
case X_LengthMSB_State :
{
NextX_State = X_LengthLSB_State;
NextByteOut = X_LengthLSB;
}
break;
case X_LengthLSB_State :
{
NextX_State = X_API_State;
NextByteOut = X_API;
}
break;
case X_API_State :
{
NextX_State = X_FID_State;
NextByteOut = X_FID;
}
break;
case X_FID_State :
{
NextX_State = X_AddrMSB_State;
NextByteOut = X_AddrMSB;
}
break;
case X_AddrMSB_State :
{
NextX_State = X_AddrLSB_State;
NextByteOut = X_AddrLSB;
}
break;
case X_AddrLSB_State :
{
NextX_State = X_Options_State;
NextByteOut = X_Options;
}
break;
case X_Options_State :
{
NextX_State = X_CMD_State; // will later need logic here for what transition to do based on length LSB
//.........这里部分代码省略.........
开发者ID:humbleSeraph,项目名称:Messi-tron-Code,代码行数:101,代码来源:CoachMasterCode.c
示例19: ParMETIS_V3_NodeND
/***********************************************************************************
* This function is the entry point of the parallel ordering algorithm.
* This function assumes that the graph is already nice partitioned among the
* processors and then proceeds to perform recursive bisection.
************************************************************************************/
void ParMETIS_V3_NodeND(idxtype *vtxdist, idxtype *xadj, idxtype *adjncy, int *numflag,
int *options, idxtype *order, idxtype *sizes, MPI_Comm *comm)
{
int i, j;
int ltvwgts[MAXNCON];
int nparts, npes, mype, wgtflag = 0, seed = GLOBAL_SEED;
CtrlType ctrl;
WorkSpaceType wspace;
GraphType *graph, *mgraph;
idxtype *morder;
int minnvtxs;
MPI_Comm_size(*comm, &npes);
MPI_Comm_rank(*comm, &mype);
nparts = npes;
if (!ispow2(npes)) {
if (mype == 0)
printf("Error: The number of processors must be a power of 2!\n");
return;
}
if (vtxdist[npes] < (int)((float)(npes*npes)*1.2)) {
if (mype == 0)
printf("Error: Too many processors for this many vertices.\n");
return;
}
minnvtxs = vtxdist[1]-vtxdist[0];
for (i=0; i<npes; i++)
minnvtxs = (minnvtxs < vtxdist[i+1]-vtxdist[i]) ? minnvtxs : vtxdist[i+1]-vtxdist[i];
if (minnvtxs < (int)((float)npes*1.1)) {
if (mype == 0)
printf("Error: vertices are not distributed equally.\n");
return;
}
if (*numflag == 1)
ChangeNumbering(vtxdist, xadj, adjncy, order, npes, mype, 1);
SetUpCtrl(&ctrl, nparts, options[PMV3_OPTION_DBGLVL], *comm);
ctrl.CoarsenTo = amin(vtxdist[npes]+1, 25*npes);
ctrl.CoarsenTo = amin(vtxdist[npes]+1, 25*amax(npes, nparts));
ctrl.seed = mype;
ctrl.sync = seed;
ctrl.partType = STATIC_PARTITION;
ctrl.ps_relation = -1;
ctrl.tpwgts = fsmalloc(nparts, 1.0/(float)(nparts), "tpwgts");
ctrl.ubvec[0] = 1.03;
graph = Moc_SetUpGraph(&ctrl, 1, vtxdist, xadj, NULL, adjncy, NULL, &wgtflag);
PreAllocateMemory(&ctrl, graph, &wspace);
/*=======================================================
* Compute the initial k-way partitioning
=======================================================*/
IFSET(ctrl.dbglvl, DBG_TIME, InitTimers(&ctrl));
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.TotalTmr));
Moc_Global_Partition(&ctrl, graph, &wspace);
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, stoptimer(ctrl.TotalTmr));
IFSET(ctrl.dbglvl, DBG_TIME, PrintTimingInfo(&ctrl));
/*=======================================================
* Move the graph according to the partitioning
=======================================================*/
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.MoveTmr));
MALLOC_CHECK(NULL);
graph->ncon = 1;
mgraph = Moc_MoveGraph(&ctrl, graph, &wspace);
MALLOC_CHECK(NULL);
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, stoptimer(ctrl.MoveTmr));
/*=======================================================
* Now compute an ordering of the moved graph
=======================================================*/
IFSET(ctrl.dbglvl, DBG_TIME, MPI_Barrier(ctrl.gcomm));
IFSET(ctrl.dbglvl, DBG_TIME, starttimer(ctrl.TotalTmr));
FreeWSpace(&wspace);
PreAllocateMemory(&ctrl, mgraph, &wspace);
ctrl.ipart = ISEP_NODE;
ctrl.CoarsenTo = amin(vtxdist[npes]+1, amax(20*npes, 1000));
//.........这里部分代码省略.........
开发者ID:KnoooW,项目名称:gpgpu-sim,代码行数:101,代码来源:ometis.c
示例20: main
int main(void)
{
//STATIC_ASSERT(sizeof(uint16_t) == 2);
InitGPIO();
InitSPI_soft();
InitI2C_soft();
InitADC();
InitSystemTimer();
InitTimers();
InitMessages();
InitCC2500(preferredSettings); //(const uint8_t **)conf(+6bytes of code), preferredSettings
uart0_init( UART_BAUD_SELECT(RS485_BAUDRATE, F_CPU) );
//_delay_ms(5000);
//InitEXTI();
//MCUCR |= (_BV(ISC11) | _BV(ISC01));
/*check Watchdog reset flag*/
if(bit_is_set(MCUCSR, WDRF)) {
//increase wathcdog reset counter and save in eeprom
}
set_sleep_mode(SLEEP_MODE_IDLE); //варианты SLEEP_MODE_PWR_SAVE SLEEP_MODE_IDLE SLEEP_MODE_ADC
//wdt_enable(WDTO_2S);
sei(); //enable interrupts
for (uint8_t i = 0; i<0x05; i++) {
//_spi_start();
//spi_TxRx(0x9D);
//_spi_stop();
_delay_ms(100);
PORTC |= _BV(PC2); //blink for test
_delay_ms(100);
PORTC &= ~_BV(PC2);
_delay_ms(100);
RS485_DE_HIGH;
uart0_putc(0xba);
_delay_ms(2);
RS485_DE_LOW;
}
RS485_DE_LOW;
while(1) {
cc_table_state[CC_state]();
ProcessTimers(&sys_timer);
ProcessMessages();
wdt_reset();
/*enter in sleep mode until interrupts occured*/
// cli(); //disable interrupts
// if (some_condition)
// {
// sleep_enable();
// sei();
// sleep_cpu();
// sleep_disable();
// }
// sei();
}
return 0;
}
开发者ID:hylics,项目名称:IRFS105,代码行数:64,代码来源:main.c
注:本文中的InitTimers函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论