Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify simcalls
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 12 Jul 2017 17:49:37 +0000 (19:49 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 12 Jul 2017 17:49:37 +0000 (19:49 +0200)
12 files changed:
examples/s4u/app-pingpong/s4u_app-pingpong
include/simgrid/s4u/File.hpp
include/simgrid/simix.h
src/msg/msg_io.cpp
src/s4u/s4u_file.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_io.cpp
src/simix/smx_io_private.h

index bd61f7b..acb5f97 100755 (executable)
Binary files a/examples/s4u/app-pingpong/s4u_app-pingpong and b/examples/s4u/app-pingpong/s4u_app-pingpong differ
index 9fbc6f2..18d2926 100644 (file)
@@ -37,7 +37,6 @@ public:
 
   /** Simulates a write action. Returns the size of data actually written. */
   sg_size_t write(sg_size_t size);
 
   /** Simulates a write action. Returns the size of data actually written. */
   sg_size_t write(sg_size_t size);
-  sg_size_t write(sg_size_t size, sg_host_t host);
 
   /** Allows to store user data on that host */
   void setUserdata(void* data) { userdata_ = data; }
 
   /** Allows to store user data on that host */
   void setUserdata(void* data) { userdata_ = data; }
index 6a117c1..6921451 100644 (file)
@@ -289,8 +289,8 @@ XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration)
 XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
 
 /*****************************   File   **********************************/
 XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
 
 /*****************************   File   **********************************/
-XBT_PUBLIC(sg_size_t) simcall_file_read(surf_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PUBLIC(sg_size_t) simcall_file_write(surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PUBLIC(sg_size_t) simcall_file_read(surf_file_t fd, sg_size_t size);
+XBT_PUBLIC(sg_size_t) simcall_file_write(surf_file_t fd, sg_size_t size);
 /************************** MC simcalls   **********************************/
 XBT_PUBLIC(int) simcall_mc_random(int min, int max);
 
 /************************** MC simcalls   **********************************/
 XBT_PUBLIC(int) simcall_mc_random(int min, int max);
 
index 0203ed7..1913d3b 100644 (file)
@@ -323,7 +323,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
 
   /* Create file on remote host, write it and close it */
   msg_file_t fd = new simgrid::s4u::File(fullpath, dst_host, nullptr);
 
   /* Create file on remote host, write it and close it */
   msg_file_t fd = new simgrid::s4u::File(fullpath, dst_host, nullptr);
-  fd->write(read_size, dst_host);
+  fd->write(read_size);
   delete fd;
   return MSG_OK;
 }
   delete fd;
   return MSG_OK;
 }
index db1c5b2..043f6d5 100644 (file)
@@ -56,17 +56,12 @@ File::~File()
 
 sg_size_t File::read(sg_size_t size)
 {
 
 sg_size_t File::read(sg_size_t size)
 {
-  return simcall_file_read(pimpl_, size, Host::current());
+  return simcall_file_read(pimpl_, size);
 }
 
 sg_size_t File::write(sg_size_t size)
 {
 }
 
 sg_size_t File::write(sg_size_t size)
 {
-  return simcall_file_write(pimpl_,size, Host::current());
-}
-
-sg_size_t File::write(sg_size_t size, sg_host_t host)
-{
-  return simcall_file_write(pimpl_, size, host);
+  return simcall_file_write(pimpl_, size);
 }
 
 sg_size_t File::size()
 }
 
 sg_size_t File::size()
index d5c9811..f05e1f1 100644 (file)
@@ -609,18 +609,18 @@ int simcall_sem_get_capacity(smx_sem_t sem)
  * \ingroup simix_file_management
  *
  */
  * \ingroup simix_file_management
  *
  */
-sg_size_t simcall_file_read(surf_file_t fd, sg_size_t size, sg_host_t host)
+sg_size_t simcall_file_read(surf_file_t fd, sg_size_t size)
 {
 {
-  return simcall_BODY_file_read(fd, size, host);
+  return simcall_BODY_file_read(fd, size);
 }
 
 /**
  * \ingroup simix_file_management
  *
  */
 }
 
 /**
  * \ingroup simix_file_management
  *
  */
-sg_size_t simcall_file_write(surf_file_t fd, sg_size_t size, sg_host_t host)
+sg_size_t simcall_file_write(surf_file_t fd, sg_size_t size)
 {
 {
-  return simcall_BODY_file_write(fd, size, host);
+  return simcall_BODY_file_write(fd, size);
 }
 
 void simcall_run_kernel(std::function<void()> const& code)
 }
 
 void simcall_run_kernel(std::function<void()> const& code)
index 9bdee47..1966f28 100644 (file)
@@ -1480,18 +1480,6 @@ static inline void simcall_file_read__set__size(smx_simcall_t simcall, sg_size_t
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
-static inline sg_host_t simcall_file_read__get__host(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]);
-}
-static inline sg_host_t simcall_file_read__getraw__host(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<sg_host_t>(simcall->args[2]);
-}
-static inline void simcall_file_read__set__host(smx_simcall_t simcall, sg_host_t arg)
-{
-  simgrid::simix::marshal<sg_host_t>(simcall->args[2], arg);
-}
 static inline sg_size_t simcall_file_read__get__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 static inline sg_size_t simcall_file_read__get__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
@@ -1528,18 +1516,6 @@ static inline void simcall_file_write__set__size(smx_simcall_t simcall, sg_size_
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
-static inline sg_host_t simcall_file_write__get__host(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]);
-}
-static inline sg_host_t simcall_file_write__getraw__host(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<sg_host_t>(simcall->args[2]);
-}
-static inline void simcall_file_write__set__host(smx_simcall_t simcall, sg_host_t arg)
-{
-  simgrid::simix::marshal<sg_host_t>(simcall->args[2], arg);
-}
 static inline sg_size_t simcall_file_write__get__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 static inline sg_size_t simcall_file_write__get__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
@@ -1689,6 +1665,6 @@ XBT_PRIVATE int simcall_HANDLER_sem_would_block(smx_simcall_t simcall, smx_sem_t
 XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
 XBT_PRIVATE int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
 XBT_PRIVATE int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem);
-XBT_PRIVATE void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PRIVATE void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PRIVATE void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size);
+XBT_PRIVATE void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size);
 XBT_PRIVATE int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max);
\ No newline at end of file
 XBT_PRIVATE int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max);
\ No newline at end of file
index 8d0c849..486da23 100644 (file)
@@ -314,18 +314,20 @@ inline static int simcall_BODY_sem_get_capacity(smx_sem_t sem) {
     return simcall<int, smx_sem_t>(SIMCALL_SEM_GET_CAPACITY, sem);
   }
 
     return simcall<int, smx_sem_t>(SIMCALL_SEM_GET_CAPACITY, sem);
   }
 
-  inline static sg_size_t simcall_BODY_file_read(surf_file_t fd, sg_size_t size, sg_host_t host)
+  inline static sg_size_t simcall_BODY_file_read(surf_file_t fd, sg_size_t size)
   {
     /* Go to that function to follow the code flow through the simcall barrier */
   {
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_read(&SIMIX_process_self()->simcall, fd, size, host);
-    return simcall<sg_size_t, surf_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_READ, fd, size, host);
+    if (0)
+      simcall_HANDLER_file_read(&SIMIX_process_self()->simcall, fd, size);
+    return simcall<sg_size_t, surf_file_t, sg_size_t>(SIMCALL_FILE_READ, fd, size);
   }
 
   }
 
-  inline static sg_size_t simcall_BODY_file_write(surf_file_t fd, sg_size_t size, sg_host_t host)
+  inline static sg_size_t simcall_BODY_file_write(surf_file_t fd, sg_size_t size)
   {
     /* Go to that function to follow the code flow through the simcall barrier */
   {
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_write(&SIMIX_process_self()->simcall, fd, size, host);
-    return simcall<sg_size_t, surf_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_WRITE, fd, size, host);
+    if (0)
+      simcall_HANDLER_file_write(&SIMIX_process_self()->simcall, fd, size);
+    return simcall<sg_size_t, surf_file_t, sg_size_t>(SIMCALL_FILE_WRITE, fd, size);
   }
 
 inline static int simcall_BODY_mc_random(int min, int max) {
   }
 
 inline static int simcall_BODY_mc_random(int min, int max) {
index cf13847..0de896d 100644 (file)
@@ -313,14 +313,12 @@ case SIMCALL_SEM_GET_CAPACITY:
 
 case SIMCALL_FILE_READ:
   simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
 
 case SIMCALL_FILE_READ:
   simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
-                            simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]),
-                            simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
+                            simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
   break;
 
 case SIMCALL_FILE_WRITE:
   simcall_HANDLER_file_write(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
   break;
 
 case SIMCALL_FILE_WRITE:
   simcall_HANDLER_file_write(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
-                             simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]),
-                             simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
+                             simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
   break;
 
 case SIMCALL_MC_RANDOM:
   break;
 
 case SIMCALL_MC_RANDOM:
index d5b7cc1..69734e4 100644 (file)
@@ -81,8 +81,8 @@ void      sem_acquire(smx_sem_t sem) [[block]];
 void      sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
 int       sem_get_capacity(smx_sem_t sem);
 
 void      sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
 int       sem_get_capacity(smx_sem_t sem);
 
-sg_size_t   file_read(surf_file_t fd, sg_size_t size, sg_host_t host) [[block]];
-sg_size_t   file_write(surf_file_t fd, sg_size_t size, sg_host_t host) [[block]];
+sg_size_t   file_read(surf_file_t fd, sg_size_t size) [[block]];
+sg_size_t   file_write(surf_file_t fd, sg_size_t size) [[block]];
 
 int        mc_random(int min, int max);
 void       set_category(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> synchro, const char* category) [[nohandler]];
 
 int        mc_random(int min, int max);
 void       set_category(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> synchro, const char* category) [[nohandler]];
index 9d6ccb2..9361f1d 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
 
 //SIMIX FILE READ
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
 
 //SIMIX FILE READ
-void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host)
+void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size)
 {
 {
-  smx_activity_t synchro = SIMIX_file_read(fd, size, host);
+  smx_activity_t synchro = SIMIX_file_read(fd, size);
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size, sg_host_t host)
+smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size)
 {
 {
-  /* check if the host is active */
-  if (host->isOff())
-    THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname());
-
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
   synchro->surf_io                           = file->read(size);
 
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
   synchro->surf_io                           = file->read(size);
 
@@ -45,18 +41,15 @@ smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size, sg_host_t host)
 }
 
 //SIMIX FILE WRITE
 }
 
 //SIMIX FILE WRITE
-void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host)
+void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size)
 {
 {
-  smx_activity_t synchro = SIMIX_file_write(fd,  size, host);
+  smx_activity_t synchro = SIMIX_file_write(fd, size);
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_activity_t SIMIX_file_write(surf_file_t file, sg_size_t size, sg_host_t host)
+smx_activity_t SIMIX_file_write(surf_file_t file, sg_size_t size)
 {
 {
-  if (host->isOff())
-    THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->getCname());
-
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
   synchro->surf_io                           = file->write(size);
   synchro->surf_io->setData(synchro);
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
   synchro->surf_io                           = file->write(size);
   synchro->surf_io->setData(synchro);
index e51804d..db1c66d 100644 (file)
@@ -11,8 +11,8 @@
 #include "simgrid/simix.h"
 #include "popping_private.h"
 
 #include "simgrid/simix.h"
 #include "popping_private.h"
 
-XBT_PRIVATE smx_activity_t SIMIX_file_read(surf_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PRIVATE smx_activity_t SIMIX_file_write(surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PRIVATE smx_activity_t SIMIX_file_read(surf_file_t fd, sg_size_t size);
+XBT_PRIVATE smx_activity_t SIMIX_file_write(surf_file_t fd, sg_size_t size);
 
 XBT_PRIVATE void SIMIX_io_destroy(smx_activity_t synchro);
 XBT_PRIVATE void SIMIX_io_finish(smx_activity_t synchro);
 
 XBT_PRIVATE void SIMIX_io_destroy(smx_activity_t synchro);
 XBT_PRIVATE void SIMIX_io_finish(smx_activity_t synchro);