Esempio n. 1
0
void tcg_igop(long type, long *x, long n, char *op)
{
    long atype = type;
    long an = n;
    long *ax;
    int i;

    ax = (long*)malloc(n * sizeof(long));
    for (i=0; i<n; ++i) {
        ax[i] = (long)x[i];
    }
    IGOP_(&atype, ax, &an, op, strlen(op));
    for (i=0; i<n; ++i) {
        x[i] = (long)ax[i];
    }
    free(ax);
}
Esempio n. 2
0
int
CKTconvTest (CKTcircuit * ckt)
{
  int i;
  int error = OK;
#ifdef PARALLEL_ARCH
  int ibuf[2];
  long type = MT_CONV, length = 2;
#endif /* PARALLEL_ARCH */

  for (i = 0; i < DEVmaxnum; i++)
    {
      if (DEVices[i] && ((*DEVices[i]).DEVconvTest != NULL) && (ckt->CKThead[i] != NULL))
	{
	  error = (*((*DEVices[i]).DEVconvTest)) (ckt->CKThead[i], ckt);
	}
#ifdef PARALLEL_ARCH
      if (error || ckt->CKTnoncon)
	goto combine;
#else
      if (error)
	return (error);
      if (ckt->CKTnoncon)
	{
	  /* printf("convTest: device %s failed\n",
	   * (*DEVices[i]).DEVpublic.name); */
	  return (OK);
	}
#endif /* PARALLEL_ARCH */
    }
#ifdef PARALLEL_ARCH
combine:
  /* See if any of the DEVconvTest functions bailed. If not, proceed. */
  ibuf[0] = error;
  ibuf[1] = ckt->CKTnoncon;
  IGOP_ (&type, ibuf, &length, "+");
  ckt->CKTnoncon = ibuf[1];
  if (ibuf[0] != error)
    {
      error = E_MULTIERR;
    }
  return (error);
#else
  return (OK);
#endif /* PARALLEL_ARCH */
}
Esempio n. 3
0
static void TestGlobals()
{
#define MAXLENG 256*1024
    double *dtest;
    long *itest;
    long len;
    long me = NODEID_(), nproc = NNODES_(), from=NNODES_()-1;
    long itype=3+MSGINT, dtype=4+MSGDBL;

    if (me == 0) {
        (void) printf("Global test ... test brodcast, igop and dgop\n----------\n\n");
        (void) fflush(stdout);
    }

    if (!(dtest = (double *) malloc((unsigned) (MAXLENG*sizeof(double)))))
        Error("TestGlobals: failed to allocated dtest", (long) MAXLENG);
    if (!(itest = (long *) malloc((unsigned) (MAXLENG*sizeof(long)))))
        Error("TestGlobals: failed to allocated itest", (long) MAXLENG);

    for (len=1; len<MAXLENG; len*=2) {
        long ilen = len*sizeof(long);
        long dlen = len*sizeof(double);
        long i;

        if (me == 0) {
            printf("Test length = %d ... ", len);
            fflush(stdout);
        }

        /* Test broadcast */

        if (me == (nproc-1)) {
            for (i=0; i<len; i++) {
                itest[i] = i;
                dtest[i] = (double) itest[i];
            }
        }
        else {
            for (i=0; i<len; i++) {
                itest[i] = 0;
                dtest[i] = 0.0;
            }
        }
        BRDCST_(&itype, (char *) itest, &ilen, &from);
        BRDCST_(&dtype, (char *) dtest, &dlen, &from);

        for (i=0; i<len; i++)
            if (itest[i] != i || dtest[i] != (double) i)
                Error("TestGlobal: broadcast failed", (long) i);

        if (me == 0) {
            printf("broadcast OK ...");
            fflush(stdout);
        }

        /* Test global sum */

        for (i=0; i<len; i++) {
            itest[i] = i*me;
            dtest[i] = (double) itest[i];
        }

        IGOP_(&itype, itest, &len, "+");
        DGOP_(&dtype, dtest, &len, "+");

        for (i=0; i<len; i++) {
            long iresult = i*nproc*(nproc-1)/2;
            if (itest[i] != iresult || dtest[i] != (double) iresult) {
                printf(" dt %f it %ld ir %ld \n",dtest[i],itest[i],iresult);
                Error("TestGlobals: global sum failed", (long) i);
            }
        }

        if (me == 0) {
            printf("global sums OK\n");
            fflush(stdout);
        }
    }

    free((char *) itest);
    free((char *) dtest);
}
Esempio n. 4
0
int
CKTacLoad(CKTcircuit *ckt)
{
    int i;
    int size;
    int error;
#ifdef PARALLEL_ARCH
    long type = MT_ACLOAD, length = 1;
#endif /* PARALLEL_ARCH */
    double startTime;

    startTime  = SPfrontEnd->IFseconds();
    size = SMPmatSize(ckt->CKTmatrix);
    for (i=0;i<=size;i++) {
        *(ckt->CKTrhs+i)=0;
        *(ckt->CKTirhs+i)=0;
    }
    SMPcClear(ckt->CKTmatrix);

    for (i=0;i<DEVmaxnum;i++) {
        if ( DEVices[i] && ((*DEVices[i]).DEVacLoad != NULL) && (ckt->CKThead[i] != NULL) ){
            error = (*((*DEVices[i]).DEVacLoad))(ckt->CKThead[i],ckt);
#ifdef PARALLEL_ARCH
	    if (error) goto combine;
#else
            if(error) return(error);
#endif /* PARALLEL_ARCH */
        }
    }
    
#ifdef XSPICE
   /* gtri - begin - Put resistors to ground at all nodes. */
    /* Value of resistor is set by new "rshunt" option.     */

    if(ckt->enh->rshunt_data.enabled) {
       for(i = 0; i < ckt->enh->rshunt_data.num_nodes; i++) {
          *(ckt->enh->rshunt_data.diag[i]) +=
                               ckt->enh->rshunt_data.gshunt;
       }
    }

    /* gtri - end - Put resistors to ground at all nodes */



    /* gtri - add - wbk - 11/26/90 - reset the MIF init flags */

    /* init is set by CKTinit and should be true only for first load call */
    g_mif_info.circuit.init = MIF_FALSE;

    /* anal_init is set by CKTdoJob and is true for first call */
    /* of a particular analysis type */
    g_mif_info.circuit.anal_init = MIF_FALSE;

    /* gtri - end - wbk - 11/26/90 */
#endif

    
#ifdef PARALLEL_ARCH
combine:
    ckt->CKTstat->STATloadTime += SPfrontEnd->IFseconds() - startTime;
    startTime  = SPfrontEnd->IFseconds();
    /* See if any of the DEVload functions bailed. If not, proceed. */
    IGOP_( &type, &error, &length, "max" );
    ckt->CKTstat->STATsyncTime += SPfrontEnd->IFseconds() - startTime;
    if (error == OK) {
      startTime  = SPfrontEnd->IFseconds();
      SMPcCombine( ckt->CKTmatrix, ckt->CKTrhs, ckt->CKTrhsSpare,
	  ckt->CKTirhs, ckt->CKTirhsSpare );
      ckt->CKTstat->STATcombineTime += SPfrontEnd->IFseconds() - startTime;
      return(OK);
    } else {
      return(error);
    }
#else
    ckt->CKTstat->STATloadTime += SPfrontEnd->IFseconds() - startTime;
    return(OK);
#endif /* PARALLEL_ARCH */
}