Beispiel #1
0
void
init_cuda(void)
{
    if (first_time) Cuda_Initialize();
    first_time = FALSE;

    AtomEq = YAP_LookupAtom("=");
    AtomGt = YAP_LookupAtom(">");
    AtomLt = YAP_LookupAtom("<");
    AtomGe = YAP_LookupAtom(">=");
    AtomLe = YAP_LookupAtom("=<");
    AtomDf = YAP_LookupAtom("\\=");
    AtomNt = YAP_LookupAtom("not");
    YAP_UserCPredicate("load_facts", load_facts, 4);
    YAP_UserCPredicate("cuda_init_facts", cuda_init_facts, 4);
    YAP_UserCPredicate("cuda_load_fact", cuda_load_fact, 1);
    YAP_UserCPredicate("load_rule", load_rule, 4);
    YAP_UserCPredicate("cuda_erase", cuda_erase, 1);
    YAP_UserCPredicate("cuda_eval", cuda_eval, 3);
    YAP_UserCPredicate("cuda_coverage", cuda_coverage, 4);
    YAP_UserCPredicate("cuda_count", cuda_count, 2);
    YAP_UserCPredicate("cuda_statistics", cuda_statistics, 0);

#ifdef ROCKIT
    YAP_UserCPredicate("cuda_init_query", cuda_init_query, 1);
#endif

}
Beispiel #2
0
void
init_random(void)
{
  YAP_UserCPredicate("random", p_random, 1);
  YAP_UserCPredicate("setrand", p_setrand, 3);
  YAP_UserCPredicate("getrand", p_getrand, 3);
}
Beispiel #3
0
void init_my_predicates()
{
    YAP_UserCPredicate("float_val", float_val, 2);
    YAP_UserCPredicate("int_val", int_val, 2);
    YAP_UserCPredicate("list_val", list_val, 2);
    YAP_UserCPredicate("init_r", init_r, 0);
    YAP_UserCPredicate("send_r_command", send_r_command, 1);
}
Beispiel #4
0
void
init_matrices(void)
{
  YAP_UserCPredicate("int_max_of_matrix", int_max_of_matrix, 3);
  YAP_UserCPredicate("float_max_of_matrix", float_max_of_matrix, 3);
  YAP_UserCPredicate("int_min_of_matrix", int_min_of_matrix, 3);
  YAP_UserCPredicate("float_min_of_matrix", float_min_of_matrix, 3);
}
Beispiel #5
0
void init_rl(void){

     
 YAP_UserCPredicate("rl_new", p_rl_new,2);        //  Maximum -> RangeID
 YAP_UserCPredicate("rl_free", p_rl_free,1);      //  RangeId ->
 YAP_UserCPredicate("rl_size", p_rl_size,2);      //  RangeId -> Size (in bytes)
 YAP_UserCPredicate("rl_mem", p_rl_mem_usage,1);  //  -> TotalMemory (in bytes)

 YAP_UserCPredicate("rl_copy", p_rl_copy,2);      //  RangeId  -> NewRangeId
 YAP_UserCPredicate("rl_set_out", p_rl_set_out,2);//  RangeId x Number  ->
 YAP_UserBackCPredicate("rl_in", p_rl_b_in1,p_rl_b_in2,2,sizeof(yap_back_data_type));   //  +RangeId x ?Number 
 //YAP_UserCPredicate("rl_in", p_rl_in,2);        //  RangeId x Number  ->
 YAP_UserCPredicate("rl_set_in", p_rl_set_in,2);  //  RangeIdxNumber  -> 
 YAP_UserCPredicate("rl_set_all_in", p_rl_set_all_in,1); //  RangeId -> 

 YAP_UserCPredicate("rl_print", p_rl_print,1);    //  RangeId ->

 YAP_UserCPredicate("rl_freeze", p_rl_freeze,1);  //  RangeId
 
 // fprintf(stderr,"Range list  module succesfully loaded.");
 //fflush(stderr);
}
Beispiel #6
0
void init_lbfgs_predicates( void ) 
{ 
  fcall3 = YAP_MkFunctor(YAP_LookupAtom("$lbfgs_callback_evaluate"), 3);
  fprogress8 = YAP_MkFunctor(YAP_LookupAtom("$lbfgs_callback_progress"), 8);

  //Initialize the parameters for the L-BFGS optimization.
  lbfgs_parameter_init(&param);


  YAP_UserCPredicate("optimizer_reserve_memory",optimizer_initialize,1);
  YAP_UserCPredicate("optimizer_run",optimizer_run,2);
  YAP_UserCPredicate("optimizer_free_memory",optimizer_finalize,0);

  YAP_UserCPredicate("optimizer_set_x",set_x_value,2);
  YAP_UserCPredicate("optimizer_get_x",get_x_value,2);
  YAP_UserCPredicate("optimizer_set_g",set_g_value,2);
  YAP_UserCPredicate("optimizer_get_g",get_g_value,2);

  YAP_UserCPredicate("optimizer_set_parameter",optimizer_set_parameter,2);
  YAP_UserCPredicate("optimizer_get_parameter",optimizer_get_parameter,2);
}  
Beispiel #7
0
X_API void init_sys(void) {
#if HAVE_MKTIME
  tzset();
#endif
  YAP_UserCPredicate("datime", datime, 2);
  YAP_UserCPredicate("mktime", sysmktime, 8);
  YAP_UserCPredicate("file_property", file_property, 7);
  YAP_UserCPredicate("unlink", p_unlink, 2);
  YAP_UserCPredicate("rmdir", p_rmdir, 2);
  YAP_UserCPredicate("dir_separator", dir_separator, 1);
  YAP_UserCPredicate("p_environ", p_environ, 2);
  YAP_UserCPredicate("exec_command", execute_command, 6);
  YAP_UserCPredicate("do_shell", do_shell, 5);
  YAP_UserCPredicate("do_system", do_system, 3);
  YAP_UserCPredicate("plwait", plwait, 4);
  YAP_UserCPredicate("host_name", host_name, 2);
  YAP_UserCPredicate("host_id", host_id, 2);
  YAP_UserCPredicate("pid", pid, 2);
  YAP_UserCPredicate("kill", p_kill, 3);
  YAP_UserCPredicate("mktemp", p_mktemp, 3);
  YAP_UserCPredicate("list_directory", list_directory, 3);
  YAP_UserCPredicate("tmpnam", p_tmpnam, 2);
  YAP_UserCPredicate("tmpdir", p_tmpdir, 2);
  YAP_UserCPredicate("rename_file", rename_file, 3);
  YAP_UserCPredicate("read_link", read_link, 2);
  YAP_UserCPredicate("error_message", error_message, 2);
  YAP_UserCPredicate("win", win, 0);
  YAP_UserCPredicate("md5", md5, 3);
}
Beispiel #8
0
/********************************************************************
 * Init
 *******************************************************************/
void 
init_mpi(void) {

  requests=new_hashtable(HASHSIZE);
  broadcasts=new_hashtable(HASHSIZE);
  DEL_BUFFER();
  YAP_UserCPredicate( "mpi_init",  mpi_init,0);                            // mpi_init/0
#ifdef USE_THREADS
  YAP_UserCPredicate( "mpi_init_rcv_thread", mpi_init_rcv_thread,1);       // mpi_init_rcv_thread(+HandleMsgGoal/1)
#endif
  YAP_UserCPredicate( "mpi_finalize", mpi_finalize,0);                     // mpi_finalize turn
  YAP_UserCPredicate( "mpi_comm_size", mpi_comm_size,1);                   // mpi_comm_size(-Size)
  YAP_UserCPredicate( "mpi_comm_rank",  mpi_comm_rank,1);                  // mpi_comm_rank(-Rank)
  YAP_UserCPredicate( "mpi_version", mpi_version,2);                       // mpi_version(-Major,-Minor)
  YAP_UserCPredicate( "mpi_get_processor_name", mpi_get_processor_name,1); // mpi_get_processor_name(-Name)
  YAP_UserCPredicate( "mpi_send", mpi_send,3);                             // mpi_send(+Data, +Destination, +Tag).
  YAP_UserCPredicate( "mpi_isend",mpi_isend,4);
  YAP_UserCPredicate( "mpi_recv", mpi_recv,3);                             // mpi_recv(?Source,?Tag,-Data).
  YAP_UserCPredicate( "mpi_irecv", mpi_irecv,3);                           // mpi_irecv(?Source,?Tag,-Handle).
  YAP_UserCPredicate( "mpi_wait", mpi_wait,2);                             // mpi_wait(+Handle,-Status).
  YAP_UserCPredicate( "mpi_wait_recv", mpi_wait_recv,3);                    // mpi_wait_recv(+Handle,-Status,-Data).
  YAP_UserCPredicate( "mpi_test", mpi_test,2);                             // mpi_test(+Handle,-Status).
  YAP_UserCPredicate( "mpi_test_recv", mpi_test_recv,3);                    // mpi_test(+Handle,-Status,-Data).
  YAP_UserCPredicate( "mpi_bcast", mpi_bcast,2);                           // mpi_bcast(Root,Term)
  YAP_UserCPredicate( "mpi_bcast2", mpi_bcast2,2);                         // mpi_bcast2(Root,Term)
  YAP_UserCPredicate( "mpi_bcast3", mpi_bcast3,3);                         // mpi_bcast3(Root,Term,Tag)
/** @pred mpi_bcast3(+ _Root_, + _Data_, + _Tag_)


Broadcasts the message  _Data_ with tag  _Tag_ from the process with rank  _Root_
to all other processes.

 
*/
  YAP_UserCPredicate( "mpi_ibcast2", mpi_ibcast2,2);                         // mpi_ibcast(Root,Term)
  YAP_UserCPredicate( "mpi_ibcast3", mpi_ibcast3,3);                         // mpi_ibcast(Root,Term,Tag)
/** @pred mpi_ibcast(+ _Root_, + _Data_, + _Tag_) 



Non-blocking operation. Broadcasts the message  _Data_ with tag  _Tag_
from the process with rank  _Root_ to all other processes.

 
*/
  YAP_UserCPredicate( "mpi_barrier", mpi_barrier,0);                       // mpi_barrier/0
  YAP_UserCPredicate( "mpi_gc", mpi_gc,0);                                 // mpi_gc/0
  YAP_UserCPredicate( "mpi_default_buffer_size", mpi_default_buffer_size,2);        // buffer size
/** @pred mpi_default_buffer_size(- _OldBufferSize_, ? _NewBufferSize_) 



The  _OldBufferSize_ argument unifies with the current size of the
MPI communication buffer size and sets the communication buffer size
 _NewBufferSize_. The buffer is used for assynchronous waiting and
for broadcast receivers. Notice that buffer is local at each MPI
process.

 
*/
#ifdef MPISTATS
  YAP_UserCPredicate( "mpi_stats", mpi_stats,7);                            // mpi_stats(-Time,#MsgsRecv,BytesRecv,MaxRecev,#MsgSent,BytesSent,MaxSent)
  YAP_UserCPredicate( "mpi_reset_stats", mpi_reset_stats,0);                // cleans the timers
  RESET_STATS();
#endif
  //  YAP_UserCPredicate( "mpi_gather", mpi_gather,0); //mpi_gather(+RootRank,?SendData,?RecvData)
  // Each process (root process included) sends the contents of its send buffer to the root process. The root process receives the messages and stores them in rank order. The outcome is  as if each of the  n processes in the group (including the root process) had executed a call to MPI_Send and the root had executed n calls to MPI_Recv.  The receive buffer is ignored for all non-root processes.
  // MPI_Scatter
#ifdef DEBUG
  fprintf(stderr,"MPI  module succesfully loaded.");
  fflush(stderr);
#endif
}
Beispiel #9
0
SYM_REC_PTR insert_cpred(const char *s, int n, int(*f)(void))
{
  YAP_UserCPredicate(s, f, n);
  return NULL;
}
Beispiel #10
0
void init_my_predicates()
/* function required by YAP for intitializing the predicates defined by a C
   function*/
{
  srand(10);

  YAP_UserCPredicate("init", init, 2);
  YAP_UserCPredicate("init_bdd", init_bdd, 0);
  YAP_UserCPredicate("end", end, 0);
  YAP_UserCPredicate("end_bdd", end_bdd, 0);
  YAP_UserCPredicate("add_var", add_var, 4);
  YAP_UserCPredicate("equality", equality, 3);
  YAP_UserCPredicate("and", and, 3);
  YAP_UserCPredicate("one", one, 1);
  YAP_UserCPredicate("zero", zero, 1);
  YAP_UserCPredicate("or", or, 3);
  YAP_UserCPredicate("bdd_not", bdd_not, 2);
  YAP_UserCPredicate("create_dot", create_dot, 2);
  YAP_UserCPredicate("init_test", init_test, 1);
  YAP_UserCPredicate("end_test", end_test, 0);
  YAP_UserCPredicate("ret_prob", ret_prob, 2);
  YAP_UserCPredicate("em", EM, 8);
  YAP_UserCPredicate("q", Q, 4);
  YAP_UserCPredicate("randomize", randomize, 0);
  YAP_UserCPredicate("deref", rec_deref, 1);
  YAP_UserCPredicate("garbage_collect", garbage_collect, 2);
  YAP_UserCPredicate("bdd_to_add", bdd_to_add, 2);
  YAP_UserCPredicate("paths_to_non_zero", paths_to_non_zero, 2);
  YAP_UserCPredicate("paths", paths, 2);
  YAP_UserCPredicate("dag_size", dag_size, 2);
}
Beispiel #11
0
 void init_my_predicates() {
   YAP_UserCPredicate("cfoo",c_foo,1);
   YAP_UserCPredicate("av",c_add_vertex,1);
   YAP_UserCPredicate("lv",c_list_vertices,0);
 }
Beispiel #12
0
void
init_matlab(void)
{
  MatlabAddress = YAP_MkFunctor(YAP_LookupAtom("MATLAB"),1);
  YAP_UserCPredicate("start_matlab", p_startmatlab, 1);
  YAP_UserCPredicate("close_matlab", p_closematlab, 0);
  YAP_UserCPredicate("matlab_on", p_matlabon, 0);
  YAP_UserCPredicate("matlab_eval_string", p_evalstring2, 1);
  YAP_UserCPredicate("matlab_eval_string", p_evalstring3, 2);
  YAP_UserCPredicate("matlab_cells", p_create_cell_vector, 2);
  YAP_UserCPredicate("matlab_cells", p_create_cell_array, 3);
  YAP_UserCPredicate("matlab_initialized_cells", p_create_cell_matrix_and_copy1, 4);
  YAP_UserCPredicate("matlab_zeros", p_create_double_vector, 2);
  YAP_UserCPredicate("matlab_zeros", p_create_double_array, 3);
  YAP_UserCPredicate("matlab_zeros", p_create_double_array3, 4);
  YAP_UserCPredicate("matlab_int_array", p_set_int_array, 4);
  YAP_UserCPredicate("matlab_vector", p_set_float_vector, 3);
  YAP_UserCPredicate("matlab_matrix", p_set_float_array, 4);
  YAP_UserCPredicate("matlab_set_int", p_set_int, 4);
  YAP_UserCPredicate("matlab_set", p_set_float, 4);
  YAP_UserCPredicate("matlab_get_variable", p_get_variable, 2);
  YAP_UserCPredicate("matlab_item", p_item, 3);
  YAP_UserCPredicate("matlab_item", p_item2, 4);
  YAP_UserCPredicate("matlab_item1", p_item_1, 3);
  YAP_UserCPredicate("matlab_item1", p_item2_1, 4);
  YAP_UserCPredicate("matlab_call_matlab", p_call_matlab, 5);
}
Beispiel #13
0
void init_my_predicates()
/* function required by YAP for intitializing the predicates defined by a C function*/
{
    YAP_UserCPredicate("compute_prob",compute_prob,4);
}
Beispiel #14
0
void init_itries(void) {
  itrie_init_module();

  YAP_UserCPredicate("itrie_open", p_itrie_open, 1);
  YAP_UserCPredicate("itrie_close", p_itrie_close, 1);
  YAP_UserCPredicate("itrie_close_all", p_itrie_close_all, 0);
  YAP_UserCPredicate("itrie_mode", p_itrie_mode, 2);
  YAP_UserCPredicate("itrie_timestamp", p_itrie_timestamp, 2);
  YAP_UserCPredicate("itrie_put_entry", p_itrie_put_entry, 2);
  YAP_UserCPredicate("itrie_update_entry", p_itrie_update_entry, 2);
  YAP_UserCPredicate("itrie_check_entry", p_itrie_check_entry, 3);
  YAP_UserCPredicate("itrie_get_entry", p_itrie_get_entry, 2);
  YAP_UserCPredicate("itrie_get_data", p_itrie_get_data, 2);
  YAP_UserBackCPredicate("itrie_traverse", p_itrie_traverse_init, p_itrie_traverse_cont, 2, 0);
  YAP_UserCPredicate("itrie_remove_entry", p_itrie_remove_entry, 1);
  YAP_UserCPredicate("itrie_remove_subtree", p_itrie_remove_subtree, 1);
  YAP_UserCPredicate("itrie_add", p_itrie_add, 2);
  YAP_UserCPredicate("itrie_subtract", p_itrie_subtract, 2);
  YAP_UserCPredicate("itrie_join", p_itrie_join, 2);
  YAP_UserCPredicate("itrie_intersect", p_itrie_intersect, 2);
  YAP_UserCPredicate("itrie_count_join", p_itrie_count_join, 3);
  YAP_UserCPredicate("itrie_count_intersect", p_itrie_count_intersect, 3);
  YAP_UserCPredicate("itrie_save", p_itrie_save, 2);
  YAP_UserCPredicate("itrie_save_as_trie", p_itrie_save_as_trie, 2);
  YAP_UserCPredicate("itrie_load", p_itrie_load, 2);
  YAP_UserCPredicate("itrie_save2stream", p_itrie_save2stream, 2);
  YAP_UserCPredicate("itrie_loadFromstream", p_itrie_loadFromStream, 2);
  YAP_UserCPredicate("itrie_stats", p_itrie_stats, 4);
  YAP_UserCPredicate("itrie_max_stats", p_itrie_max_stats, 4);
  YAP_UserCPredicate("itrie_usage", p_itrie_usage, 4);
  YAP_UserCPredicate("itrie_print", p_itrie_print, 1);
  return;
}
Beispiel #15
0
void
init_regexp(void)
{
  YAP_UserCPredicate("check_regexp", check_regexp, 5);
  YAP_UserCPredicate("check_regexp", regexp, 7);
}
Beispiel #16
0
void init_tries(void) {
  trie_init_module();

  YAP_UserCPredicate("trie_open", p_trie_open, 1);
  YAP_UserCPredicate("trie_close", p_trie_close, 1);
  YAP_UserCPredicate("trie_close_all", p_trie_close_all, 0);
  YAP_UserCPredicate("trie_mode", p_trie_mode, 1);
  YAP_UserCPredicate("trie_put_entry", p_trie_put_entry, 3);
  YAP_UserCPredicate("trie_check_entry", p_trie_check_entry, 3);
  YAP_UserCPredicate("trie_get_entry", p_trie_get_entry, 2);
  YAP_UserCPredicate("trie_get_first_entry", p_trie_get_first_entry, 2);
  YAP_UserCPredicate("trie_get_last_entry", p_trie_get_last_entry, 2);
  YAP_UserBackCPredicate("trie_traverse", p_trie_traverse_init, p_trie_traverse_cont, 3, 0);
  YAP_UserCPredicate("trie_remove_entry", p_trie_remove_entry, 1);
  YAP_UserCPredicate("trie_remove_subtree", p_trie_remove_subtree, 1);
  YAP_UserCPredicate("trie_join", p_trie_join, 2);
  YAP_UserCPredicate("trie_intersect", p_trie_intersect, 2);
  YAP_UserCPredicate("trie_count_join", p_trie_count_join, 3);
  YAP_UserCPredicate("trie_count_intersect", p_trie_count_intersect, 3);
  YAP_UserCPredicate("trie_save", p_trie_save, 2);
  YAP_UserCPredicate("trie_load", p_trie_load, 2);
  YAP_UserCPredicate("trie_usage", p_trie_usage, 4);
  YAP_UserCPredicate("trie_stats", p_trie_stats, 4);
  YAP_UserCPredicate("trie_max_stats", p_trie_max_stats, 4);
  YAP_UserCPredicate("trie_print", p_trie_print, 1);
  /* backwards compatibility */
  YAP_UserCPredicate("open_trie", p_open_trie, 1);
  YAP_UserCPredicate("close_trie", p_close_trie, 1);
  YAP_UserCPredicate("close_all_tries", p_close_all_tries, 0);
  YAP_UserCPredicate("put_trie_entry", p_put_trie_entry, 4);
  YAP_UserCPredicate("get_trie_entry", p_get_trie_entry, 3);
  YAP_UserCPredicate("remove_trie_entry", p_remove_trie_entry, 1);
  YAP_UserCPredicate("print_trie", p_print_trie, 1);
  YAP_UserCPredicate("trie_tree", p_trie_tree, 2);
  return;
}