- XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", getPath(), localStorage->getCname(), size, size_);
+ if (size == 0) /* Nothing to write, return */
+ return 0;
+
+ /* Find the host where the file is physically located (remote or local)*/
+ Host* host = local_storage_->get_host();
+
+ if (host->get_name() != Host::current()->get_name()) {
+ /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
+ XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", host->get_cname(), size);
+ std::vector<Host*> m_host_list = {Host::current(), host};
+ std::vector<double> flops_amount = {0, 0};
+ std::vector<double> bytes_amount = {0, static_cast<double>(size), 0, 0};
+
+ this_actor::parallel_execute(m_host_list, flops_amount, bytes_amount);
+ }
+
+ XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", get_path(), local_storage_->get_cname(), size, size_);