X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b65f44359644f1fdbe91077e7d379453a16f857a..6e5457a22be7df9fa12847d3f18c43c4619bc3e2:/src/simix/smx_user.c diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 5b58220cc7..fb7560746e 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1,6 +1,18 @@ +/* smx_user.c - public interface to simix */ + +/* Copyright (c) 2010, 2011. Da SimGrid team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ +#define _SVID_SOURCE /* strdup */ +#define _ISO_C99_SOURCE /* isfinite() */ +#define _ISOC99_SOURCE /* isfinite() */ +#include /* isfinite() */ + #include "private.h" #include "mc/mc.h" + XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix); static const char* request_names[] = { @@ -154,6 +166,10 @@ smx_action_t SIMIX_req_host_execute(const char *name, smx_host_t host, double computation_amount, double priority) { + /* checking for infinite values */ + xbt_assert(isfinite(computation_amount), "computation_amount is not finite!"); + xbt_assert(isfinite(priority), "priority is not finite!"); + smx_req_t req = SIMIX_req_mine(); req->call = REQ_HOST_EXECUTE; @@ -186,6 +202,19 @@ smx_action_t SIMIX_req_host_parallel_execute(const char *name, double amount, double rate) { + int i,j; + /* checking for infinite values */ + for (i = 0 ; i < host_nb ; ++i) { + xbt_assert(isfinite(computation_amount[i]), "computation_amount[%d] is not finite!", i); + for (j = 0 ; j < host_nb ; ++j) { + xbt_assert(isfinite(communication_amount[i + host_nb * j]), + "communication_amount[%d+%d*%d] is not finite!", i, host_nb, j); + } + } + + xbt_assert(isfinite(amount), "amount is not finite!"); + xbt_assert(isfinite(rate), "rate is not finite!"); + smx_req_t req = SIMIX_req_mine(); req->call = REQ_HOST_PARALLEL_EXECUTE; @@ -271,6 +300,9 @@ e_smx_state_t SIMIX_req_host_execution_get_state(smx_action_t execution) */ void SIMIX_req_host_execution_set_priority(smx_action_t execution, double priority) { + /* checking for infinite values */ + xbt_assert(isfinite(priority), "priority is not finite!"); + smx_req_t req = SIMIX_req_mine(); req->call = REQ_HOST_EXECUTION_SET_PRIORITY; @@ -564,6 +596,9 @@ xbt_dict_t SIMIX_req_process_get_properties(smx_process_t process) */ e_smx_state_t SIMIX_req_process_sleep(double duration) { + /* checking for infinite values */ + xbt_assert(isfinite(duration), "duration is not finite!"); + smx_req_t req = SIMIX_req_mine(); req->call = REQ_PROCESS_SLEEP; @@ -660,6 +695,11 @@ void SIMIX_req_comm_send(smx_rdv_t rdv, double task_size, double rate, int (*match_fun)(void *, void *), void *data, double timeout) { + /* checking for infinite values */ + xbt_assert(isfinite(task_size), "task_size is not finite!"); + xbt_assert(isfinite(rate), "rate is not finite!"); + xbt_assert(isfinite(timeout), "timeout is not finite!"); + xbt_assert(rdv, "No rendez-vous point defined for send"); if (MC_IS_ENABLED) { @@ -690,6 +730,10 @@ smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate, int (*match_fun)(void *, void *), void *data, int detached) { + /* checking for infinite values */ + xbt_assert(isfinite(task_size), "task_size is not finite!"); + xbt_assert(isfinite(rate), "rate is not finite!"); + xbt_assert(rdv, "No rendez-vous point defined for isend"); smx_req_t req = SIMIX_req_mine(); @@ -711,6 +755,7 @@ smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate, void SIMIX_req_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *), void *data, double timeout) { + xbt_assert(isfinite(timeout), "timeout is not finite!"); xbt_assert(rdv, "No rendez-vous point defined for recv"); if (MC_IS_ENABLED) { @@ -805,6 +850,8 @@ int SIMIX_req_comm_testany(xbt_dynar_t comms) void SIMIX_req_comm_wait(smx_action_t comm, double timeout) { + xbt_assert(isfinite(timeout), "timeout is not finite!"); + smx_req_t req = SIMIX_req_mine(); req->call = REQ_COMM_WAIT; @@ -1025,6 +1072,8 @@ void SIMIX_req_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) { + xbt_assert(isfinite(timeout), "timeout is not finite!"); + smx_req_t req = SIMIX_req_mine(); req->call = REQ_COND_WAIT_TIMEOUT; @@ -1100,6 +1149,8 @@ void SIMIX_req_sem_acquire(smx_sem_t sem) void SIMIX_req_sem_acquire_timeout(smx_sem_t sem, double timeout) { + xbt_assert(isfinite(timeout), "timeout is not finite!"); + smx_req_t req = SIMIX_req_mine(); req->call = REQ_SEM_ACQUIRE_TIMEOUT;