#! tesh
! output sort
-! timeout 15
+! timeout 30
$ java -cp ${classpath:=.} async/AsyncTest ${srcdir:=.}/platform.xml ${srcdir:=.}/async/asyncDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (10:async.Slave@Robert) Receiving on 'slave_8'
> [ 0.000000] (11:async.Slave@Sirois) Receiving on 'slave_9'
/***************** Centralized Mutual Exclusion Algorithm *********************/
/* This example implements a centralized mutual exclusion algorithm. */
-/* CS requests of client 1 not satisfied */
+/* Bug : CS requests of client 1 not satisfied */
/* LTL property checked : G(r->F(cs)); (r=request of CS, cs=CS ok) */
/******************************************************************************/
{
int CS_used = 0;
- msg_task_t task = NULL, answer = NULL;
+ msg_task_t task = NULL, answer = NULL;
+ xbt_dynar_t requests = xbt_dynar_new(sizeof(char *), NULL);
while(1){
MSG_task_receive(&task, "coordinator");
if (!strcmp(kind, "request")) {
char *req = MSG_task_get_data(task);
if (CS_used) {
- XBT_INFO("CS already used.");
+ XBT_INFO("CS already used. Queue the request.");
+ xbt_dynar_push(requests, &req);
} else {
if(strcmp(req, "1") != 0){
XBT_INFO("CS idle. Grant immediatly");
answer = NULL;
}
}
- } else {
- XBT_INFO("CS release. resource now idle");
- CS_used = 0;
+ } else {
+ if (!xbt_dynar_is_empty(requests)) {
+ XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests));
+ char *req;
+ xbt_dynar_pop(requests, &req);
+ if(strcmp(req, "1") != 0){
+ MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req);
+ }else{
+ xbt_dynar_push(requests, &req);
+ }
+ }else{
+ XBT_INFO("CS release. resource now idle");
+ CS_used = 0;
+ }
}
MSG_task_destroy(task);
task = NULL;
+/***************** Centralized Mutual Exclusion Algorithm *********************/
+/* This example implements a centralized mutual exclusion algorithm. */
+/* Bug : CS requests of process 1 not satisfied */
+/* LTL property checked : G(r->F(cs)); (r=request of CS, cs=CS ok) */
+/******************************************************************************/
+
#include <stdio.h>
#include <mpi.h>
#include <simgrid/modelchecker.h>
int main(int argc, char **argv){
- //int i;
int err, size, rank;
int recv_buff;
MPI_Status status;
int CS_used = 0;
+ xbt_dynar_t requests = xbt_dynar_new(sizeof(int), NULL);
/* Initialize MPI */
err = MPI_Init(&argc, &argv);
err = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(rank == 0){ /* Coordinator */
- //for(i=0; i<size-1; i++) {
while(1){
MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
if(status.MPI_TAG == REQUEST_TAG){
if(CS_used){
printf("CS already used.\n");
+ xbt_dynar_push(requests, &recv_buff);
}else{
if(recv_buff != 1){
printf("CS idle. Grant immediatly.\n");
}
}
}else{
- printf("CS release. Resource now idle.\n");
- CS_used = 0;
+ if(!xbt_dynar_is_empty(requests)){
+ printf("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests));
+ xbt_dynar_pop(requests, &recv_buff);
+ if(recv_buff != 1){
+ MPI_Send(&rank, 1, MPI_INT, recv_buff, GRANT_TAG, MPI_COMM_WORLD);
+ CS_used = 1;
+ }else{
+ xbt_dynar_push(requests, &recv_buff);
+ }
+ }else{
+ printf("CS release. Resource now idle.\n");
+ CS_used = 0;
+ }
}
}
}else{ /* Client */
< replay/actions_bcast.txt
$ mkfile replay/one_trace
-! timeout 30
+! timeout 60
$ ../../bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/cpu_threshold:1 -np 3 -platform ${srcdir:=.}/replay/replay_platform.xml -hostfile ${srcdir:=.}/hostfile ./smpi_replay replay/one_trace
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9'
int block;
}s_stack_region_t, *stack_region_t;
-void stack_region_free_voidp(void *s);
-
void heap_ignore_region_free(mc_heap_ignore_region_t r);
void heap_ignore_region_free_voidp(void *r);
static void MC_snapshot_stack_free(mc_snapshot_stack_t s){
if(s){
- xbt_free(s->local_variables->data);
- xbt_free(s->local_variables);
+ xbt_dynar_free(&(s->local_variables));
xbt_free(s);
}
}
local_variable_free((local_variable_t) * (void **) v);
}
+static void MC_region_destroy(mc_mem_region_t reg)
+{
+ xbt_free(reg->data);
+ xbt_free(reg);
+}
+
+void MC_free_snapshot(mc_snapshot_t snapshot){
+ unsigned int i;
+ for(i=0; i < NB_REGIONS; i++)
+ MC_region_destroy(snapshot->regions[i]);
+
+ xbt_free(snapshot->stack_sizes);
+ xbt_dynar_free(&(snapshot->stacks));
+ xbt_dynar_free(&(snapshot->to_ignore));
+ xbt_free(snapshot);
+}
+
/******************************* Snapshot regions ********************************/
/*********************************************************************************/
before copying the data */
memcpy(reg->start_addr, reg->data, reg->size);
-
return;
}
-static void MC_region_destroy(mc_mem_region_t reg)
-{
- xbt_free(reg->data);
- xbt_free(reg);
-}
-
static void MC_snapshot_add_region(mc_snapshot_t snapshot, int type, void *start_addr, size_t size)
{
mc_mem_region_t new_reg = MC_region_new(type, start_addr, size);
int frame_found = 0, region_type;
void *frame_pointer_address = NULL;
long true_ip, value;
+ int stop;
xbt_dynar_t variables = xbt_dynar_new(sizeof(local_variable_t), local_variable_free_voidp);
- while(ret >= 0){
+ while(ret >= 0 && !stop){
unw_get_reg(&c, UNW_REG_IP, &ip);
unw_get_reg(&c, UNW_REG_SP, &sp);
unw_get_proc_name(&c, frame_name, sizeof (frame_name), &off);
+ if(!strcmp(frame_name, "smx_ctx_sysv_wrapper")) /* Stop before context switch with maestro */
+ stop = 1;
+
if((long)ip > (long)start_text_libsimgrid)
frame = xbt_dict_get_or_null(mc_local_variables_libsimgrid, frame_name);
else
}
-void MC_free_snapshot(mc_snapshot_t snapshot){
- unsigned int i;
- for(i=0; i < NB_REGIONS; i++)
- MC_region_destroy(snapshot->regions[i]);
-
- xbt_free(snapshot->stack_sizes);
- xbt_dynar_free(&(snapshot->stacks));
- xbt_dynar_free(&(snapshot->to_ignore));
- xbt_free(snapshot);
-}
-
mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){
return MC_take_snapshot();
}
xbt_dynar_t compared_pointers;
-static int heap_region_compare(void *d1, void *d2, size_t size);
+/************************** Free functions ****************************/
+/********************************************************************/
-static void stack_region_free(stack_region_t s);
+static void stack_region_free(stack_region_t s){
+ if(s){
+ xbt_free(s->process_name);
+ xbt_free(s);
+ }
+}
+
+static void stack_region_free_voidp(void *s){
+ stack_region_free((stack_region_t) * (void **) s);
+}
+
+static void pointers_pair_free(pointers_pair_t p){
+ xbt_free(p);
+}
+
+static void pointers_pair_free_voidp(void *p){
+ pointers_pair_free((pointers_pair_t) * (void **)p);
+}
-static int compare_local_variables(mc_snapshot_stack_t stack1, mc_snapshot_stack_t stack2, void *heap1, void *heap2);
-static int compare_global_variables(int region_type, mc_mem_region_t r1, mc_mem_region_t r2);
-static int compare_pointer(char *pointer_type, void *addr_pointed1, void *addr_pointed2, int region_size, int region_type);
-static int compare_areas_with_type(void *area1, void *area2, xbt_dict_t types, xbt_dict_t other_types, char *type_id, int region_size, int region_type, void *start_data, int pointer_level);
+/************************** Snapshot comparison *******************************/
+/******************************************************************************/
static int already_compared_pointers(void *p1, void *p2){
cursor = (start + end) / 2;
pair = (pointers_pair_t)xbt_dynar_get_as(compared_pointers, cursor, pointers_pair_t);
if(pair->p1 == p1){
- if(pair->p2 == p2)
+ if(pair->p2 == p2){
+ pointers_pair_free(new_pair);
return;
- else if(pair->p2 < p2)
+ }else if(pair->p2 < p2)
start = cursor + 1;
else
end = cursor - 1;
static int compare_global_variables(int region_type, mc_mem_region_t r1, mc_mem_region_t r2){
if(!compared_pointers){
- compared_pointers = xbt_dynar_new(sizeof(pointers_pair_t), NULL);
+ compared_pointers = xbt_dynar_new(sizeof(pointers_pair_t), pointers_pair_free_voidp);
MC_ignore_global_variable("compared_pointers");
}else{
xbt_dynar_reset(compared_pointers);
if(res == -1){
xbt_dynar_cursor_rm(variables, &cursor);
}else if(res == 1){
- XBT_VERB("Global variable %s is different between snapshots", current_var->name);
+ XBT_VERB("Global variable %s (%p - %p) is different between snapshots", current_var->name, (char *)r1->data + offset, (char *)r2->data + offset);
+ xbt_dynar_free(&compared_pointers);
return 1;
}
}
+
+ xbt_dynar_free(&compared_pointers);
+
return 0;
}
static int compare_local_variables(mc_snapshot_stack_t stack1, mc_snapshot_stack_t stack2, void *heap1, void *heap2){
if(!compared_pointers){
- compared_pointers = xbt_dynar_new(sizeof(pointers_pair_t), NULL);
+ compared_pointers = xbt_dynar_new(sizeof(pointers_pair_t), pointers_pair_free_voidp);
MC_ignore_global_variable("compared_pointers");
}else{
xbt_dynar_reset(compared_pointers);
if(xbt_dynar_length(stack1->local_variables) != xbt_dynar_length(stack2->local_variables)){
XBT_VERB("Different number of local variables");
+ xbt_dynar_free(&compared_pointers);
return 1;
}else{
unsigned int cursor = 0;
while(cursor < xbt_dynar_length(stack1->local_variables)){
current_var1 = (local_variable_t)xbt_dynar_get_as(stack1->local_variables, cursor, local_variable_t);
current_var2 = (local_variable_t)xbt_dynar_get_as(stack2->local_variables, cursor, local_variable_t);
- if(strcmp(current_var1->name, current_var2->name) != 0 || strcmp(current_var1->frame, current_var2->frame) != 0 || current_var1->ip != current_var2->ip)
+ if(strcmp(current_var1->name, current_var2->name) != 0 || strcmp(current_var1->frame, current_var2->frame) != 0 || current_var1->ip != current_var2->ip){
+ xbt_dynar_free(&compared_pointers);
return 1;
+ }
offset1 = (char *)current_var1->address - (char *)std_heap;
offset2 = (char *)current_var2->address - (char *)std_heap;
if(current_var1->region == 1)
res = compare_areas_with_type( (char *)heap1 + offset1, (char *)heap2 + offset2, mc_variables_type_binary, mc_variables_type_libsimgrid, current_var1->type, 0, 2, start_data_binary, 0l);
if(res == 1){
XBT_VERB("Local variable %s (%p - %p) in frame %s is different between snapshots", current_var1->name, (char *)heap1 + offset1, (char *)heap2 + offset2, current_var1->frame);
+ xbt_dynar_free(&compared_pointers);
return res;
}
cursor++;
}
+ xbt_dynar_free(&compared_pointers);
return 0;
}
}
-
-static int heap_region_compare(void *d1, void *d2, size_t size){
-
- size_t i = 0;
-
- for(i=0; i<size; i++){
- if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
- if(XBT_LOG_ISENABLED(mc_compare, xbt_log_priority_verbose)){
- XBT_VERB("Different byte (offset=%zu) (%p - %p) in heap region", i, (char *)d1 + i, (char *)d2 + i);
- }
- return 1;
- }
- }
-
- return 0;
-}
-
-static void stack_region_free(stack_region_t s){
- if(s){
- xbt_free(s->process_name);
- xbt_free(s);
- }
-}
-
-void stack_region_free_voidp(void *s){
- stack_region_free((stack_region_t) * (void **) s);
-}
-
-int SIMIX_pre_mc_compare_snapshots(smx_simcall_t simcall,
- mc_snapshot_t s1, mc_snapshot_t s2){
- return snapshot_compare(s1, s2);
-}
-
int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
int raw_mem = (mmalloc_get_current_heap() == raw_heap);
XBT_VERB("Different size used in stacks : %zu - %zu", size_used1, size_used2);
#endif
+ xbt_os_walltimer_stop(timer);
xbt_os_timer_free(timer);
xbt_os_walltimer_stop(global_timer);
mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
XBT_VERB("Different hash of global variables : %s - %s", s1->hash_global, s2->hash_global);
#endif
+ xbt_os_walltimer_stop(timer);
xbt_os_timer_free(timer);
xbt_os_walltimer_stop(global_timer);
mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
xbt_os_timer_free(global_timer);
-
+
if(!raw_mem)
MC_UNSET_RAW_MEM;
XBT_VERB("Different hash of local variables : %s - %s", s1->hash_local, s2->hash_local);
#endif
+ xbt_os_walltimer_stop(timer);
xbt_os_timer_free(timer);
xbt_os_walltimer_stop(global_timer);
mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
xbt_os_timer_free(global_timer);
-
+
if(!raw_mem)
MC_UNSET_RAW_MEM;
#endif
reset_heap_information();
+ xbt_os_walltimer_stop(timer);
xbt_os_timer_free(timer);
xbt_os_walltimer_stop(global_timer);
mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
#endif
reset_heap_information();
+ xbt_os_walltimer_stop(timer);
xbt_os_timer_free(timer);
xbt_os_walltimer_stop(global_timer);
mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
#endif
reset_heap_information();
+ xbt_os_walltimer_stop(timer);
xbt_os_timer_free(timer);
xbt_os_walltimer_stop(global_timer);
mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
XBT_DEBUG("Different heap (mmalloc_compare)");
errors++;
#else
-
- xbt_os_timer_free(timer);
#ifdef MC_VERBOSE
XBT_VERB("Different heap (mmalloc_compare)");
#endif
reset_heap_information();
+ xbt_os_walltimer_stop(timer);
+ xbt_os_timer_free(timer);
xbt_os_walltimer_stop(global_timer);
mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
xbt_os_timer_free(global_timer);
}
reset_heap_information();
-
+
+ xbt_os_walltimer_stop(timer);
xbt_os_timer_free(timer);
#ifdef MC_VERBOSE
}
-int MC_compare_snapshots(void *s1, void *s2){
-
- MC_ignore_local_variable("self", "simcall_BODY_mc_snapshot");
-
- return simcall_mc_compare_snapshots(s1, s2);
-
-}
+/***************************** Statistics *****************************/
+/*******************************************************************/
void print_comparison_times(){
XBT_DEBUG("*** Comparison times ***");
XBT_DEBUG("- Heap : %f", mc_comp_times->heap_comparison_time);
XBT_DEBUG("- Stacks : %f", mc_comp_times->stacks_comparison_time);
}
+
+/**************************** MC snapshot compare simcall **************************/
+/***********************************************************************************/
+
+int SIMIX_pre_mc_compare_snapshots(smx_simcall_t simcall,
+ mc_snapshot_t s1, mc_snapshot_t s2){
+ return snapshot_compare(s1, s2);
+}
+
+int MC_compare_snapshots(void *s1, void *s2){
+
+ MC_ignore_local_variable("self", "simcall_BODY_mc_snapshot");
+ return simcall_mc_compare_snapshots(s1, s2);
+
+}
xbt_free(p);
p = NULL;
}
+
+void mc_pair_free_voidp(void *p){
+ MC_pair_delete((mc_pair_t) * (void **)p);
+}
mc_pair_t MC_pair_new(void);
void MC_pair_delete(mc_pair_t);
+void mc_pair_free_voidp(void *p);
void MC_ddfs_init(void);
void MC_ddfs(void);
/* Set size used in the fragment to -1 */
mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = -1;
-
+ mdp->heapinfo[block].busy_frag.ignore[frag_nb] = 0;
+ mdp->heapinfo[block].busy_frag.equal_to[frag_nb] = NULL;
+
// fprintf(stderr,"nfree:%zu capa:%d\n", mdp->heapinfo[block].busy_frag.nfree,(BLOCKSIZE >> type));
if (mdp->heapinfo[block].busy_frag.nfree ==
(BLOCKSIZE >> type) - 1) {
mdp->heapinfo[block].type = 0;
mdp->heapinfo[block].busy_block.size = 1;
mdp->heapinfo[block].busy_block.busy_size = 0;
+ mdp->heapinfo[block].busy_block.equal_to = NULL;
/* Keep the statistics accurate. */
mdp -> heapstats.chunks_used++;
if(heapinfo1[i].type == 0){
heap_area_free(heapinfo1[i].busy_block.equal_to);
heapinfo1[i].busy_block.equal_to = NULL;
- }
- if(heapinfo1[i].type > 0){
+ }else if(heapinfo1[i].type > 0){
for(j=0; j < (size_t) (BLOCKSIZE >> heapinfo1[i].type); j++){
heap_area_free(heapinfo1[i].busy_frag.equal_to[j]);
heapinfo1[i].busy_frag.equal_to[j] = NULL;
if(heapinfo2[i].type == 0){
heap_area_free(heapinfo2[i].busy_block.equal_to);
heapinfo2[i].busy_block.equal_to = NULL;
- }
- if(heapinfo2[i].type > 0){
+ }else if(heapinfo2[i].type > 0){
for(j=0; j < (size_t) (BLOCKSIZE >> heapinfo2[i].type); j++){
heap_area_free(heapinfo2[i].busy_frag.equal_to[j]);
heapinfo2[i].busy_frag.equal_to[j] = NULL;
/* mark the space previously occupied by the block info as free by first marking it
* as occupied in the regular way, and then freing it */
- for (it=0; it<BLOCKIFY(mdp->heapsize * sizeof(malloc_info)); it++)
+ for (it=0; it<BLOCKIFY(mdp->heapsize * sizeof(malloc_info)); it++){
newinfo[BLOCK(oldinfo)+it].type = 0;
+ newinfo[BLOCK(oldinfo)+it].busy_block.ignore = 0;
+ newinfo[BLOCK(oldinfo+it)].busy_block.equal_to = NULL;
+ }
newinfo[BLOCK(oldinfo)].busy_block.size = BLOCKIFY(mdp->heapsize * sizeof(malloc_info));
newinfo[BLOCK(oldinfo)].busy_block.busy_size = size;
- newinfo[BLOCK(oldinfo)].busy_block.ignore = 0;
- newinfo[BLOCK(oldinfo)].busy_block.equal_to = NULL;
//newinfo[BLOCK(oldinfo)].busy_block.bt_size = 0;// FIXME setup the backtrace
mfree(mdp, (void *) oldinfo);
mdp->heapsize = newsize;
int it;
/* The new size is smaller; return excess memory to the free list. */
//printf("(%s) return excess memory...",xbt_thread_self_name());
- for (it= block+blocks; it< mdp->heapinfo[block].busy_block.size ; it++)
+ for (it= block+blocks; it< mdp->heapinfo[block].busy_block.size ; it++){
mdp->heapinfo[it].type = 0; // FIXME that should be useless, type should already be 0 here
+ mdp->heapinfo[it].busy_block.ignore = 0;
+ mdp->heapinfo[it].busy_block.equal_to = NULL;
+ }
mdp->heapinfo[block + blocks].busy_block.size
= mdp->heapinfo[block].busy_block.size - blocks;
# Smpi Alltoall collectives tests
! setenv LD_LIBRARY_PATH=../../lib
! output sort
+! timeout 30
p Test all to all
$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../../examples/msg/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ./gather_coll