Example #1
0
void kol_main()
{

#define NUM 20000

kol_struct_import *imp_qs;

int	*a;
int	i;

CONSOLE_INIT("Example");

imp_qs = kol_cofflib_load("/sys/lib/qs.obj");
qsi = ( _stdcall void (*)(int*, int))
		kol_cofflib_procload (imp_qs, "qsi");

a = malloc(NUM*sizeof(int));

for (i = 0; i < NUM; i++)
	*(a+i) = random(10000);

for (i = 0; i < 5; i++)
	printf("%7d", *(a+i));

printf ("    ...");

for (i = NUM-5; i < NUM; i++)
	printf("%7d", *(a+i));

qsi(a, NUM);

printf ("\n");

for (i = 0; i < 5; i++)
	printf("%7d", *(a+i));

printf ("    ...");

for (i = NUM-5; i < NUM; i++)
	printf("%7d", *(a+i));


free(a);

_exit(0);
kol_exit();
}
/* Get the CPU speed, try sampling facility first and CPU attributes second. */
static void cf_diag_get_cpu_speed(void)
{
	if (cpum_sf_avail()) {			/* Sampling facility first */
		struct hws_qsi_info_block si;

		memset(&si, 0, sizeof(si));
		if (!qsi(&si)) {
			cf_diag_cpu_speed = si.cpu_speed;
			return;
		}
	}

	if (test_facility(34)) {		/* CPU speed extract static part */
		unsigned long mhz = __ecag(ECAG_CPU_ATTRIBUTE, 0);

		if (mhz != -1UL)
			cf_diag_cpu_speed = mhz & 0xffffffff;
	}
}
static void sl_print_sampling(struct seq_file *m)
{
	struct hws_qsi_info_block si;

	memset(&si, 0, sizeof(si));
	if (qsi(&si))
		return;

	if (!si.as && !si.ad)
		return;

	seq_printf(m, "CPU-MF: Sampling facility: min_rate=%lu max_rate=%lu"
		   " cpu_speed=%u\n", si.min_sampl_rate, si.max_sampl_rate,
		   si.cpu_speed);
	if (si.as)
		seq_printf(m, "CPU-MF: Sampling facility: mode=basic"
			   " sample_size=%u\n", si.bsdes);
	if (si.ad)
		seq_printf(m, "CPU-MF: Sampling facility: mode=diagnostic"
			   " sample_size=%u\n", si.dsdes);
}
static void print_debug_sf(void)
{
	struct hws_qsi_info_block si;
	int cpu = smp_processor_id();

	memset(&si, 0, sizeof(si));
	if (qsi(&si))
		return;

	pr_info("CPU[%i] CPUM_SF: basic=%i diag=%i min=%lu max=%lu cpu_speed=%u\n",
		cpu, si.as, si.ad, si.min_sampl_rate, si.max_sampl_rate,
		si.cpu_speed);

	if (si.as)
		pr_info("CPU[%i] CPUM_SF: Basic-sampling: a=%i e=%i c=%i"
			" bsdes=%i tear=%016lx dear=%016lx\n", cpu,
			si.as, si.es, si.cs, si.bsdes, si.tear, si.dear);
	if (si.ad)
		pr_info("CPU[%i] CPUM_SF: Diagnostic-sampling: a=%i e=%i c=%i"
			" dsdes=%i tear=%016lx dear=%016lx\n", cpu,
			si.ad, si.ed, si.cd, si.dsdes, si.tear, si.dear);
}
Example #5
0
void InputDataStruct::UpdateLeakoff(TPZCompMesh * cmesh)
{
  
  
#ifdef PZDEBUG
  if(fLeakoffmap.size() == 0)
  {//Se a fratura nao alcancou ainda a regiao elastica 2, este mapa estah vazio!!!
   //DebugStop();
  }
#endif
  
  std::map<int,REAL>::iterator it;
  
  int outVlCount = 0;
  for(int i = 0;  i < cmesh->ElementVec().NElements(); i++)
  {
    ///////////////////////
    TPZCompEl * cel = cmesh->ElementVec()[i];
    
#ifdef PZDEBUG
    if(!cel)
    {
      DebugStop();
    }
#endif
    
    TPZGeoEl * gel = cel->Reference();
    
    if(gel->Dimension() != 1)
    {
      continue;
    }
    
    TPZInterpolatedElement * sp = dynamic_cast <TPZInterpolatedElement*> (cel);
    if(!sp)
    {
      continue;
    }
    
    it = globFractInputData.GetLeakoffmap().find(gel->Id());
    
    if(it == globFractInputData.GetLeakoffmap().end())
    {
      continue;
    }
    
    TPZVec<REAL> qsi(1,0.);
    cel->Reference()->CenterPoint(cel->Reference()->NSides()-1, qsi);
    TPZMaterialData data;
    sp->InitMaterialData(data);
    
    sp->ComputeShape(qsi, data);
    sp->ComputeSolution(qsi, data);
    
    REAL pfrac = data.sol[0][0];
    ///////////////////////
    
    REAL deltaT = globFractInputData.actDeltaT();
    
    REAL VlAcum = it->second;
    REAL tStar = FictitiousTime(VlAcum, pfrac);
    REAL Vlnext = VlFtau(pfrac, tStar + deltaT);
    
    if (fusingLeakOff) {
      it->second = Vlnext;
    }
    else{
      it->second = 0.;
    }

    outVlCount++;
  }
  
#ifdef PZDEBUG
  if(outVlCount < globFractInputData.GetLeakoffmap().size())
  {
    DebugStop();
  }
#endif
}