X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d9e2eb51f2650b1468c22d15f636a6e24fdbf3cc..60a81418ae15d47b18247171b721e207b71d6279:/src/bindings/python/simgrid_python.cpp diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 037c2ffde0..3d3a86c1e8 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -223,9 +223,9 @@ PYBIND11_MODULE(simgrid, m) "Registers the main function of an actor"); /* Class Netzone */ - py::class_>(m, "NetZone", - "Networking Zones") - .def_static("create_full_zone", &simgrid::s4u::create_full_zone, "Creates a zone of type FullZone") + py::class_> netzone(m, "NetZone", + "Networking Zones"); + netzone.def_static("create_full_zone", &simgrid::s4u::create_full_zone, "Creates a zone of type FullZone") .def_static("create_torus_zone", &simgrid::s4u::create_torus_zone, "Creates a cluster of type Torus") .def_static("create_fatTree_zone", &simgrid::s4u::create_fatTree_zone, "Creates a cluster of type Fat-Tree") .def_static("create_dragonfly_zone", &simgrid::s4u::create_dragonfly_zone, "Creates a cluster of type Dragonfly") @@ -293,14 +293,16 @@ PYBIND11_MODULE(simgrid, m) const std::pair&, unsigned int>()); /* Class Host */ - py::class_>(m, "Host", "Simulated host") - .def("by_name", &Host::by_name, "Retrieves a host from its name, or die") + py::class_> host(m, "Host", "Simulated host"); + host.def("by_name", &Host::by_name, "Retrieves a host from its name, or die") .def("get_pstate_count", &Host::get_pstate_count, "Retrieve the count of defined pstate levels") .def("get_pstate_speed", &Host::get_pstate_speed, "Retrieve the maximal speed at the given pstate") .def("get_netpoint", &Host::get_netpoint, "Retrieve the netpoint associated to this host") .def("get_disks", &Host::get_disks, "Retrieve the list of disks in this host") .def("set_core_count", &Host::set_core_count, "Set the number of cores in the CPU") .def("set_coordinates", &Host::set_coordinates, "Set the coordinates of this host") + .def("set_sharing_policy", &simgrid::s4u::Host::set_sharing_policy, "Describe how the CPU is shared", + py::arg("policy"), py::arg("cb") = simgrid::s4u::NonLinearResourceCb()) .def("create_disk", py::overload_cast(&Host::create_disk), "Create a disk") .def("create_disk", py::overload_cast(&Host::create_disk), @@ -328,6 +330,10 @@ PYBIND11_MODULE(simgrid, m) "speed", &Host::get_speed, "The peak computing speed in flops/s at the current pstate, taking the external load into account. " "This is the max potential speed."); + py::enum_(host, "SharingPolicy") + .value("NONLINEAR", simgrid::s4u::Host::SharingPolicy::NONLINEAR) + .value("LINEAR", simgrid::s4u::Host::SharingPolicy::LINEAR) + .export_values(); /* Class Disk */ py::class_> disk(m, "Disk", "Simulated disk"); @@ -351,8 +357,8 @@ PYBIND11_MODULE(simgrid, m) .export_values(); /* Class NetPoint */ - py::class_>( - m, "NetPoint", "NetPoint object"); + py::class_> + netpoint(m, "NetPoint", "NetPoint object"); /* Class Link */ py::class_> link(m, "Link", "Network link"); @@ -445,7 +451,7 @@ PYBIND11_MODULE(simgrid, m) py::class_(m, "PyGetAsync", "Wrapper for async get communications") .def(py::init<>()) .def( - "get", [](PyGetAsync* self) { return py::reinterpret_steal(*(self->get())); }, + "get", [](const PyGetAsync* self) { return py::reinterpret_steal(*(self->get())); }, "Get python object after async communication in receiver side"); /* Class Comm */