Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI_is_inited() and smpi_enabled() have the same purpose. Keep only the former.
[simgrid.git] / include / simgrid / simix.h
1 /* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_SIMIX_H
7 #define SIMGRID_SIMIX_H
8
9 #include <simgrid/forward.h>
10 #include <xbt/parmap.h>
11
12 #ifndef SIMIX_H_NO_DEPRECATED_WARNING
13 #warning simgrid/simix.h is deprecated and will be removed in v3.35.
14 #endif
15
16 /******************************* Networking ***********************************/
17 SG_BEGIN_DECL
18
19 /* parallelism */
20 XBT_ATTRIB_DEPRECATED_v333("Please use kernel::context::is_parallel()") XBT_PUBLIC int SIMIX_context_is_parallel();
21 XBT_ATTRIB_DEPRECATED_v333("Please use kernel::context::get_nthreads()") XBT_PUBLIC int SIMIX_context_get_nthreads();
22 XBT_ATTRIB_DEPRECATED_v333("Please use kernel::context::set_nthreads()") XBT_PUBLIC
23     void SIMIX_context_set_nthreads(int nb_threads);
24 XBT_ATTRIB_DEPRECATED_v333("Please use kernel::context::get_parallel_mode()") XBT_PUBLIC e_xbt_parmap_mode_t
25     SIMIX_context_get_parallel_mode();
26 XBT_ATTRIB_DEPRECATED_v333("Please use kernel::context::set_parallel_mode()") XBT_PUBLIC
27     void SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
28 XBT_ATTRIB_DEPRECATED_v333("Please use Actor::is_maestro()") XBT_PUBLIC int SIMIX_is_maestro();
29
30 /********************************** Global ************************************/
31 /* Set some code to execute in the maestro (must be used before the engine creation)
32  *
33  * If no maestro code is registered (the default), the main thread
34  * is assumed to be the maestro. */
35 XBT_ATTRIB_DEPRECATED_v333("Please use simgrid_set_maestro()") XBT_PUBLIC
36     void SIMIX_set_maestro(void (*code)(void*), void* data);
37
38 SG_END_DECL
39
40 /********************************* Process ************************************/
41 SG_BEGIN_DECL
42 XBT_ATTRIB_DEPRECATED_v333("Please use kernel::actor::ActorImpl::self()") XBT_PUBLIC
43 #ifdef __cplusplus
44     simgrid::kernel::actor::ActorImpl*
45 #else
46     smx_actor_t
47 #endif
48     SIMIX_process_self();
49 XBT_ATTRIB_DEPRECATED_v333("Please use xbt_procname()") XBT_PUBLIC const char* SIMIX_process_self_get_name();
50 SG_END_DECL
51
52 /****************************** Communication *********************************/
53 #ifdef __cplusplus
54 XBT_ATTRIB_DEPRECATED_v333("Please use Engine::set_default_comm_data_copy_callback()") XBT_PUBLIC
55     void SIMIX_comm_set_copy_data_callback(void (*callback)(simgrid::kernel::activity::CommImpl*, void*, size_t));
56
57 XBT_ATTRIB_DEPRECATED_v333("Please use Comm::copy_buffer_callback()") XBT_PUBLIC
58     void SIMIX_comm_copy_pointer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff, size_t buff_size);
59 XBT_ATTRIB_DEPRECATED_v333("Please use Comm::copy_pointer_callback()") XBT_PUBLIC
60     void SIMIX_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff, size_t buff_size);
61
62 /******************************************************************************/
63 /*                            SIMIX simcalls                                  */
64 /******************************************************************************/
65 /* These functions are a system call-like interface to the simulation kernel. */
66 /* They can also be called from maestro's context, and they are thread safe.  */
67 /******************************************************************************/
68
69 /************************** Communication simcalls ****************************/
70
71 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::send()") XBT_PUBLIC
72     void simcall_comm_send(simgrid::kernel::actor::ActorImpl* sender, simgrid::kernel::activity::MailboxImpl* mbox,
73                            double task_size, double rate, void* src_buff, size_t src_buff_size,
74                            bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
75                            void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
76                            double timeout);
77
78 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::isend()") XBT_PUBLIC simgrid::kernel::activity::ActivityImplPtr
79     simcall_comm_isend(simgrid::kernel::actor::ActorImpl* sender, simgrid::kernel::activity::MailboxImpl* mbox,
80                        double task_size, double rate, void* src_buff, size_t src_buff_size,
81                        bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void (*clean_fun)(void*),
82                        void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
83                        bool detached);
84
85 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::recv()") XBT_PUBLIC
86     void simcall_comm_recv(simgrid::kernel::actor::ActorImpl* receiver, simgrid::kernel::activity::MailboxImpl* mbox,
87                            void* dst_buff, size_t* dst_buff_size,
88                            bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
89                            void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
90                            double timeout, double rate);
91
92 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::irecv()") XBT_PUBLIC simgrid::kernel::activity::ActivityImplPtr
93     simcall_comm_irecv(simgrid::kernel::actor::ActorImpl* receiver, simgrid::kernel::activity::MailboxImpl* mbox,
94                        void* dst_buff, size_t* dst_buff_size,
95                        bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
96                        void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
97                        double rate);
98
99 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::wait_any_for()") XBT_PUBLIC ssize_t
100     simcall_comm_waitany(simgrid::kernel::activity::CommImpl* comms[], size_t count, double timeout);
101 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::wait_for()") XBT_PUBLIC
102     void simcall_comm_wait(simgrid::kernel::activity::ActivityImpl* comm, double timeout);
103 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::test()") XBT_PUBLIC
104     bool simcall_comm_test(simgrid::kernel::activity::ActivityImpl* comm);
105 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::test_any()") XBT_PUBLIC ssize_t
106     simcall_comm_testany(simgrid::kernel::activity::CommImpl* comms[], size_t count);
107
108 #endif
109 #endif