示例#1
0
int
p6est_vtk_write_point_vector (p6est_t * p6est,
                              const char *filename,
                              const char *vector_name, const double *values)
{
  SC_ABORT ("p6est_vtk_write_point_vector not implemented");
}
示例#2
0
void *falloc_getpage()
{
	void *res = VirtualAlloc(0, FALLOC_PAGESIZE, MEM_COMMIT, PAGE_READWRITE);
	if (!res)
		SC_ABORT();
	return res;
}
示例#3
0
	bool activate(sc_wait_type type,sc_param *prm,int len)
	{
		boost::scoped_array<sc_addr> prms(new sc_addr[len+1]);
		boost::scoped_array<bool>    consts(new bool[len+1]);

		prms[0] = descr;
		consts[0] = true;

		for (int i = 1;i < len + 1; ++i) {
			consts[i] = true;
			prms[i] = prm[i-1].addr;
			if (prms[i]->seg->ring_0)
				// just skip events in ring_0
				return false;
		}

		if (descr->dead) {
			descr->unref();
			sc_segment *seg = create_unique_segment(system_session,"/tmp/bugfix");
			descr = system_session->create_el(seg,SC_N_CONST);
			descr->ref();
			prms[0] = descr;
		}

		sc_addr son = create_orphaned_son(libsc_login(), proc, 0, 0, prms.get(), consts.get(), len + 1);
		if (!son) {
			fprintf(stderr,"Failed to start event handler. Event skiped\n");
			return false;
		}

		if (pm_sched_add_agent(son,SCHED_CLASS_NORMAL))
			SC_ABORT();

		return false;
	}
示例#4
0
sc_retval nsm_isom_init()
{
	nsm_session->open_segment("/home/nsm/config");

	sc_param param[1];
	param[0].addr = NSM_SEARCH_;
	nsm_session->attach_wait(SC_WAIT_HACK_SET_MEMBER, param, 1, new wait_active_out_arc());
	param->addr = NSM_GENERATE_;
	nsm_session->attach_wait(SC_WAIT_HACK_SET_MEMBER, param, 1, new wait_active_out_arc());
	nsm_session->attach_wait(SC_WAIT_DIE_PRE, param, 1, new wait_active_out_arc());

	activity_on_active_ = new Sact_on_active_;
	act_on_gen_ = new Sact_on_gen_;
	activity_on_confirm_ = new act_on_confirm_;

#ifdef NSM_DONT_USE_SCHEDULER
	activity_on_active_->init(0);
	act_on_gen_->init(0);
	activity_on_confirm_->init(0);
#else
	if (nsm_session->reimplement(NSM_SEARCH_, activity_on_active_)) {
		SC_ABORT();
	}

	if (nsm_session->reimplement(NSM_GENERATE_, act_on_gen_)) {
		SC_ABORT();
	}

	if (pm_sched_add_agent(NSM_SEARCH_, SCHED_CLASS_NORMAL)) {
		return 7;
	}

	if (pm_sched_add_agent(NSM_GENERATE_, SCHED_CLASS_NORMAL)) {
		return 7;
	}

	if (nsm_session->reimplement(NSM_CONFIRM_, activity_on_confirm_)) {
		SC_ABORT();
	}

	if (pm_sched_add_agent(NSM_CONFIRM_, SCHED_CLASS_NORMAL)) {
		return 7;
	}
#endif // NSM_DONT_USE_SCHEDULER

	return RV_OK;
}
示例#5
0
	mt_iterator(list *_erased,sc_iterator *hi) 
	{
		SC_ABORT();
		host_i = hi;
		erased = _erased;
		if (check_tuple())
			next();
	}
示例#6
0
	sc_retval activate(sc_session *s,sc_addr _this,sc_addr param1,sc_addr prm2,sc_addr prm3)
	{
		scp_process_info info;
		scp_fill_process_info(*father,&info);
		sc_addr value = scp_get_var_value(&info,var);
		if (!value) {
			fprintf(stderr,"wakeup_activity: cannot get variable value\n");
			SC_ABORT();
		}
		*res = (value == EV_ALLOW) ? false : true;
		pm_sched_wakeup(towake);
		return RV_OK;
	}
示例#7
0
pm_process::pm_process(pm_process *parent,sc_addr _param,proc_mode _mode)
:
	param(_param),
	mode(_mode),
	completed(false)
{
	if (!parent)
		session = libsc_login();
	else {
		session = parent->session->__fork();
		session->close_segment(parent->autoseg);
	}
	if (!session)
		SC_ABORT();
	init_pm_process();
	session->open_segment(processes_segment->get_full_uri());
	sign = session->create_el(processes_segment,SC_N_CONST);
	autoseg = create_unique_segment(session,"/tmp/pm_proc_auto");
	if (!autoseg)
		SC_ABORT();
	session->reimplement(sign,this);
	pm_sched_add_agent(sign,SCHED_CLASS_NORMAL);
}
示例#8
0
void *	falloc_getpage()
{
#if	0
	// Hm. This does not give more speed. Why ?
	if (!block || block == block_end) {
		block = (char *)mmap(0,FALLOC_PAGESIZE*4,PROT_READ|PROT_WRITE,
				MAP_PRIVATE|MAP_ANONYMOUS,0,0);
		if (block == MAP_FAILED)
			SC_ABORT();
		block_end = block+FALLOC_PAGESIZE*4;
	}
	void *res = block;
	block += 4096;
	return res;
#else

	void *res = mmap(0,FALLOC_PAGESIZE,
			PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,0,0);
	if (res == MAP_FAILED)
		SC_ABORT();
	return res;
#endif
}
示例#9
0
sc_segment *do_read_tgf(const sc_string &filename)
{
	FILE *input = fopen(filename.c_str(), "rb");
	if (!input) {
		std::cerr << "Cannot open input file!\n";
		exit(2);
	}

	int fd = fileno(input);
	tgf_stream_in *tgf_in = tgf_stream_in_new();
	if (!tgf_in) {
		goto __tgf_init_error;
	}

	tgf_stream_in_fd(tgf_in, fd);
	if (tgf_stream_in_start(tgf_in, 0)) {
__tgf_init_error:
		std::cerr << "tgf init error!\n";
		exit(2);
	}

	sc_segment *seg = create_unique_segment(system_session,"/tmp/program");
	if (!seg) {
		SC_ABORT();
	}

	if (read_tgf_to(tgf_in, system_session, seg)) {
		std::cerr << "Cannot read tgf(" << filename << ")!\n";
		SC_ABORT();
	}

	tgf_stream_in_destroy(tgf_in);
	fclose(input);

	return seg;
}
示例#10
0
	bool activate(sc_wait_type type,sc_param *prm,int len)
	{
		sc_addr towake = pm_sched_get_current();
		bool result;
		sc_addr var;
		sc_addr father;
		assert(towake);
		sc_segment *seg = create_unique_segment(system_session,
						"/tmp/pre_ev_handler");
		var = system_session->create_el(seg,SC_N_CONST);
		sc_addr ondeath = system_session->create_el(scp_segment,SC_N_CONST);
		system_session->reimplement(ondeath,
				new wakeup_activity(towake,&result,&father,var));
		sc_addr *prms = new sc_addr[len+2];
		bool	*consts = new bool[len+2];
		prms[1] = var;
		consts[1] = false;
		prms[0] = descr;
		consts[0] = true;
		for (int i=2;i<len+2;i++) {
			consts[i] = true;
			prms[i] = prm[i-2].addr;
			if (prms[i]->seg->ring_0)
				// just skip events in ring_0
				return false;
		}
		if (descr->dead) {
			descr->unref();
			sc_segment *seg = create_unique_segment(system_session,"/tmp/bugfix");
			descr = system_session->create_el(seg,SC_N_CONST);
			descr->ref();
			prms[0] = descr;
		}
		// hack (?)
		system_session->detach_wait(this);
		sc_addr son = create_orphaned_son(libsc_login(), proc, ondeath, &father, prms, consts, len + 2);
		if (!son) {
			fprintf(stderr,"Failed to start event handler. Event skiped\n");
			goto out;
		}
		if (pm_sched_add_agent(son,SCHED_CLASS_NORMAL))
			SC_ABORT();
	out:
		system_session->attach_wait(type,prm,len,this);
		pm_sched_put_to_sleep_and_switch(towake);
		return result;
	}
示例#11
0
文件: sc.c 项目: johannrudi/libsc
void
sc_abort_collective (const char *msg)
{
  int                 mpiret;

  if (sc_mpicomm != sc_MPI_COMM_NULL) {
    mpiret = sc_MPI_Barrier (sc_mpicomm);
    SC_CHECK_MPI (mpiret);
  }

  if (sc_is_root ()) {
    SC_ABORT (msg);
  }
  else {
    sleep (3);                  /* wait for root rank's sc_MPI_Abort ()... */
    abort ();                   /* ... otherwise this may call sc_MPI_Abort () */
  }
}
示例#12
0
	const sc_string value()
	{
		if (iter == list->end())
			SC_ABORT();
		return (*iter).name;
	}
示例#13
0
文件: sc.c 项目: johannrudi/libsc
void
sc_init (sc_MPI_Comm mpicomm,
         int catch_signals, int print_backtrace,
         sc_log_handler_t log_handler, int log_threshold)
{
  int                 w;
  const char         *trace_file_name;
  const char         *trace_file_prio;

  sc_identifier = -1;
  sc_mpicomm = sc_MPI_COMM_NULL;
  sc_print_backtrace = print_backtrace;

  if (mpicomm != sc_MPI_COMM_NULL) {
    int                 mpiret;

    sc_mpicomm = mpicomm;
    mpiret = sc_MPI_Comm_rank (sc_mpicomm, &sc_identifier);
    SC_CHECK_MPI (mpiret);
  }

  sc_set_signal_handler (catch_signals);
  sc_package_id = sc_package_register (log_handler, log_threshold,
                                       "libsc", "The SC Library");

  trace_file_name = getenv ("SC_TRACE_FILE");
  if (trace_file_name != NULL) {
    char                buffer[BUFSIZ];

    if (sc_identifier >= 0) {
      snprintf (buffer, BUFSIZ, "%s.%d.log", trace_file_name, sc_identifier);
    }
    else {
      snprintf (buffer, BUFSIZ, "%s.log", trace_file_name);
    }
    SC_CHECK_ABORT (sc_trace_file == NULL, "Trace file not NULL");
    sc_trace_file = fopen (buffer, "wb");
    SC_CHECK_ABORT (sc_trace_file != NULL, "Trace file open");

    trace_file_prio = getenv ("SC_TRACE_LP");
    if (trace_file_prio != NULL) {
      if (!strcmp (trace_file_prio, "SC_LP_TRACE")) {
        sc_trace_prio = SC_LP_TRACE;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_DEBUG")) {
        sc_trace_prio = SC_LP_DEBUG;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_VERBOSE")) {
        sc_trace_prio = SC_LP_VERBOSE;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_INFO")) {
        sc_trace_prio = SC_LP_INFO;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_STATISTICS")) {
        sc_trace_prio = SC_LP_STATISTICS;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_PRODUCTION")) {
        sc_trace_prio = SC_LP_PRODUCTION;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_ESSENTIAL")) {
        sc_trace_prio = SC_LP_ESSENTIAL;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_ERROR")) {
        sc_trace_prio = SC_LP_ERROR;
      }
      else {
        SC_ABORT ("Invalid trace priority");
      }
    }
  }

  w = 24;
  SC_GLOBAL_ESSENTIALF ("This is %s\n", SC_PACKAGE_STRING);
#if 0
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "F77", SC_F77);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "FFLAGS", SC_FFLAGS);
#endif
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "CPP", SC_CPP);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "CPPFLAGS", SC_CPPFLAGS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "CC", SC_CC);
#if 0
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "C_VERSION", SC_C_VERSION);
#endif
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "CFLAGS", SC_CFLAGS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "LDFLAGS", SC_LDFLAGS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "LIBS", SC_LIBS);
#if 0
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "BLAS_LIBS", SC_BLAS_LIBS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "LAPACK_LIBS", SC_LAPACK_LIBS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "FLIBS", SC_FLIBS);
#endif

#if defined(SC_ENABLE_MPI) && defined(SC_ENABLE_MPICOMMSHARED)
  if (mpicomm != MPI_COMM_NULL) {
    int                 mpiret;
    MPI_Comm            intranode, internode;

    /* compute the node comms by default */
    sc_mpi_comm_attach_node_comms (mpicomm, 0);
    sc_mpi_comm_get_node_comms (mpicomm, &intranode, &internode);
    if (intranode == MPI_COMM_NULL) {
      SC_GLOBAL_STATISTICS ("No shared memory node communicators\n");
    }
    else {
      int                 intrasize;

      mpiret = MPI_Comm_size (intranode, &intrasize);
      SC_CHECK_MPI (mpiret);

      SC_GLOBAL_STATISTICSF ("Shared memory node communicator size: %d\n",
                             intrasize);
    }
  }
#endif
}
示例#14
0
文件: sc.c 项目: aseyboldt/libsc
void
sc_init (MPI_Comm mpicomm,
         int catch_signals, int print_backtrace,
         sc_log_handler_t log_handler, int log_threshold)
{
  int                 w;
  const char         *trace_file_name;
  const char         *trace_file_prio;

  sc_identifier = -1;
  sc_mpicomm = MPI_COMM_NULL;
  sc_print_backtrace = print_backtrace;

  if (mpicomm != MPI_COMM_NULL) {
    int                 mpiret;

    sc_mpicomm = mpicomm;
    mpiret = MPI_Comm_rank (sc_mpicomm, &sc_identifier);
    SC_CHECK_MPI (mpiret);
  }

  sc_set_signal_handler (catch_signals);
  sc_package_id = sc_package_register (log_handler, log_threshold,
                                       "libsc", "The SC Library");

  trace_file_name = getenv ("SC_TRACE_FILE");
  if (trace_file_name != NULL) {
    char                buffer[BUFSIZ];

    if (sc_identifier >= 0) {
      snprintf (buffer, BUFSIZ, "%s.%d.log", trace_file_name, sc_identifier);
    }
    else {
      snprintf (buffer, BUFSIZ, "%s.log", trace_file_name);
    }
    SC_CHECK_ABORT (sc_trace_file == NULL, "Trace file not NULL");
    sc_trace_file = fopen (buffer, "wb");
    SC_CHECK_ABORT (sc_trace_file != NULL, "Trace file open");

    trace_file_prio = getenv ("SC_TRACE_LP");
    if (trace_file_prio != NULL) {
      if (!strcmp (trace_file_prio, "SC_LP_TRACE")) {
        sc_trace_prio = SC_LP_TRACE;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_DEBUG")) {
        sc_trace_prio = SC_LP_DEBUG;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_VERBOSE")) {
        sc_trace_prio = SC_LP_VERBOSE;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_INFO")) {
        sc_trace_prio = SC_LP_INFO;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_STATISTICS")) {
        sc_trace_prio = SC_LP_STATISTICS;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_PRODUCTION")) {
        sc_trace_prio = SC_LP_PRODUCTION;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_ESSENTIAL")) {
        sc_trace_prio = SC_LP_ESSENTIAL;
      }
      else if (!strcmp (trace_file_prio, "SC_LP_ERROR")) {
        sc_trace_prio = SC_LP_ERROR;
      }
      else {
        SC_ABORT ("Invalid trace priority");
      }
    }
  }

  w = 24;
  SC_GLOBAL_ESSENTIALF ("This is %s\n", SC_PACKAGE_STRING);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "CC", SC_CC);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "C_VERSION", SC_C_VERSION);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "CFLAGS", SC_CFLAGS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "CPP", SC_CPP);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "CPPFLAGS", SC_CPPFLAGS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "F77", SC_F77);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "FFLAGS", SC_FFLAGS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "LDFLAGS", SC_LDFLAGS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "BLAS_LIBS", SC_BLAS_LIBS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "LAPACK_LIBS", SC_LAPACK_LIBS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "LIBS", SC_LIBS);
  SC_GLOBAL_PRODUCTIONF ("%-*s %s\n", w, "FLIBS", SC_FLIBS);
}
示例#15
0
void falloc_relpage(void *ptr)
{
	if (!VirtualFree(ptr, FALLOC_PAGESIZE, MEM_RELEASE))
		SC_ABORT();
}
示例#16
0
int
main (int argc, char **argv)
{
  sc_MPI_Comm         mpicomm;
  int                 mpiret, mpisize;
  int                 retval, nargs;
  int                 minpoints;
  int                 d, p, n;
  double              x, y;
  sc_dmatrix_t       *points, *knots, *works;
  sc_bspline_t       *bs;

  mpiret = sc_MPI_Init (&argc, &argv);
  SC_CHECK_MPI (mpiret);

  mpicomm = sc_MPI_COMM_WORLD;
  sc_init (mpicomm, 1, 1, NULL, SC_LP_DEFAULT);

  mpiret = sc_MPI_Comm_size (mpicomm, &mpisize);
  SC_CHECK_MPI (mpiret);
  if (mpisize != 1)
    sc_abort_collective ("This program runs in serial only");

  nargs = 2;
  if (argc != nargs) {
    SC_LERRORF ("Usage: %s <degree>\n", argv[0]);
    SC_ABORT ("Usage error");
  }
  n = atoi (argv[1]);
  SC_CHECK_ABORT (n >= 0, "Degree must be non-negative");

  minpoints = sc_bspline_min_number_points (n);
  SC_INFOF ("Degree %d will require at least %d points\n", n, minpoints);

  d = 2;
  points = sc_dmatrix_new (0, d);

  p = -1;
  for (;;) {
    retval = scanf ("%lg %lg", &x, &y);
    if (retval == d) {
      ++p;
      sc_dmatrix_resize (points, p + 1, d);
      points->e[p][0] = x;
      points->e[p][1] = y;
    }
    else
      break;
  }
  SC_CHECK_ABORT (p + 1 >= minpoints, "Not enough points");
  SC_INFOF ("Points read %d\n", p + 1);

  works = sc_bspline_workspace_new (n, d);

  knots = sc_bspline_knots_new (n, points);
  bs = sc_bspline_new (n, points, knots, works);
  create_plot ("uniform", bs);
  sc_bspline_destroy (bs);
  sc_dmatrix_destroy (knots);

  if (n > 0) {
    knots = sc_bspline_knots_new_length (n, points);
    bs = sc_bspline_new (n, points, knots, works);
    create_plot ("length", bs);
    check_derivatives (bs);
    sc_bspline_destroy (bs);
    sc_dmatrix_destroy (knots);
  }

  sc_dmatrix_destroy (works);
  sc_dmatrix_destroy (points);

  sc_finalize ();

  mpiret = sc_MPI_Finalize ();
  SC_CHECK_MPI (mpiret);

  return 0;
}
示例#17
0
文件: sc_blas.c 项目: aseyboldt/libsc
int
sc_blas_nonimplemented ()
{
    SC_ABORT ("BLAS not compiled in this configuration");
    return 0;
}
示例#18
0
void	falloc_relpage(void *ptr)
{
	if (munmap(ptr,FALLOC_PAGESIZE)<0)
		SC_ABORT();
}