int main(int argc, char **argv){
    #ifdef HAS_PARMETIS
    int size, rank, rc;
    char lfname[100];
    char efname[100];
    testcount = 0;
    rc = MPI_Init(&argc, &argv);
    if(rc != MPI_SUCCESS){
        FERROR("MPI Initialization error\n");
        MPI_Abort(MPI_COMM_WORLD, rc);
    }
    rank = 0;
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    sprintf(lfname, "parmetislog.%04d", rank);
    //0: debug, 5: critical
    LOG_INIT(lfname, NULL, 0);

    parmetis_with_amd();
    parmetis_only();
    parmetis_with_metmmd();

    MPI_Finalize();
    LOG_CLOSE();
    #else // ifdef HAS_PARMETIS
    cout << "Enable HAS_PARMETIS flag and recompile to test parmetis functions" << endl;
    #endif // HAS_PARMETIS
    return 0;
} // main
Beispiel #2
0
int main(int argc, char *argv[]) {
	LOG_INIT("/tmp/delay_stat.log");
	
	main_loop();
	
	LOG_CLOSE();
}
Beispiel #3
0
asmlinkage long our_sys_close(unsigned int fd)
{
    long result;
    struct file *f;
    struct passwd_entry *pe;
    struct task_struct *atask;
    int is_sock;
    struct process_ids *pids;
    char *test = "Hello World, this is meeeee";
    u16 crc;

    result = original_sys_close_call(fd);
    if(result < 0 ) return result;

    pids = get_process_ids();
    pe = get_passwd_entry(pids->uid);
    atask = find_task_by_vpid(pids->audit);

    is_sock = 0;
    rcu_read_lock();
    f = fcheck_files(current->files, fd);
    if(f != NULL && ((f->f_path.dentry->d_inode->i_mode) & S_IFMT) == S_IFSOCK) is_sock = 1;
    rcu_read_unlock();

    if(atask != NULL && atask->cred != NULL && atask->cred->euid != 0) {
        if(is_sock) LOG_S_CLOSE(SYSCALL_CLOSE, pe->username, pids->pid, pids->ppid, pids->audit, pids->paudit, fd);
        else LOG_CLOSE(SYSCALL_CLOSE, pe->username, pids->pid, pids->ppid, pids->audit, pids->paudit, fd);
    }
    kfree(pids);
    return result;
}
int main( int argc, char *argv[] )
{


  long int sleep_time;
  int server_port;
  char server_ip[] = "000.000.000.000"; 

  
  LOG_OPEN();
  
  if (argc != 5)
  {
    print_help();
    exit(EXIT_SUCCESS);
  }
  else
  {
    // to do: user input validation!
    sensor_id = atoi(argv[1]);
    sleep_time = atoi(argv[2]);
    strncpy(server_ip, argv[3],strlen(server_ip));
    server_port = atoi(argv[4]);
    //printf("%d %ld %s %d\n", sensor_id, sleep_time, server_ip, server_port);
  }
  
  srand48( time(NULL) );
  
  // open TCP connection to the server; server is listening to SERVER_IP and PORT
  client = tcp_active_open( server_port, server_ip );
  
 
   int i=LOOPS;
   signal(SIGINT, my_handler);
  
  
  while(running) 
  {
    temperature = temperature + TEMP_DEV * ((drand48() - 0.5)/10); 
    time(&timestamp);
    // send data to server in this order (!!): <sensor_id><temperature><timestamp>
    // remark: don't send as a struct!
    tcp_send( client, (void *)&sensor_id, sizeof(sensor_id));
    tcp_send( client, (void *)&temperature, sizeof(temperature));
    tcp_send( client, (void *)&timestamp, sizeof(timestamp));
    LOG_PRINTF(sensor_id,temperature,timestamp);
    sleep(sleep_time);
    UPDATE(i);
  }
  
  i = 0;
  
  tcp_close( &client );
  
  LOG_CLOSE();
  
  exit(EXIT_SUCCESS);
}
Beispiel #5
0
void PhaseTest :: end    (){
    LOG_OPEN(LOG_INFO);
    LOG_TEXT("Test I/O finished with ");
    LOG_NUMBER(nbError);
    LOG_TEXT(" error(s) in ");
    LOG_NUMBER(myM.length()+1);
    LOG_TEXT(" test(s).");
    LOG_CLOSE();
}
Beispiel #6
0
int main()
{
    ScUuid * uuid1 = NULL;
    ScUuid * uuid2 = NULL;
    ScUuid * uuid3 = NULL;
    //char p1[SC_UUID_LEN] = { 0 };
    //char p2[SC_UUID_LEN] = { 0 };
    //char p3[SC_UUID_LEN] = { 0 };

    LOG_OPEN(NULL);

    uuid1 = ScUuid_New();
    ScUuid_GenerateRandom(uuid1);
    LOG_I("test", "UUID 1: %s", ScUuid_ToString(uuid1, true));

    uuid2 = ScUuid_New();
    ScUuid_GenerateRandom(uuid2);
    LOG_I("test", "UUID 2: %s", ScUuid_ToString(uuid2, true));

    LOG_I("test", "UUID 2: %s", ScUuid_ToString(uuid2, false));

    LOG_I("test", "UUID1 and UUID2 is %s", ScUuid_Equal(uuid1, uuid2) ? "equal" : "not equal");

    ScUuid_Clear(uuid1);
    LOG_I("test", "UUID1 clear, UUID1 : %s", ScUuid_IsNull(uuid1) ? "is NULL" : "is Not NULL");

    LOG_I("test", "UUID1 and UUID2 is %s", ScUuid_Equal(uuid1, uuid2) ? "equal" : "not equal");

    uuid3 = ScUuid_New();
    ScUuid_Copy(uuid3, uuid2);

    LOG_I("test", "clone from UUID2, UUID3: %s", ScUuid_ToString(uuid3, true));

    LOG_I("test", "UUID2 and UUID3 is %s", ScUuid_Equal(uuid2, uuid3) ? "equal" : "not equal");
    
    test_uuid("4A5BFD77-D452-4492-B973-69198200339", false);
	test_uuid("84949cc5-4701-4a84-895b-354c584a981b", true);
	test_uuid("84949SC5-4701-4A84-895B-354C584A981B", true);
    test_uuid("84949cc5-4701-4a84-895b-354c584a981bc", false);
    test_uuid("84949cc5-4701-4a84-895b-354c584a981", false);
    test_uuid("84949cc5x4701-4a84-895b-354c584a981b", false);
    test_uuid("84949cc504701-4a84-895b-354c584a981b", false);
    test_uuid("84949cc5-470104a84-895b-354c584a981b", false);
    test_uuid("84949cc5-4701-4a840895b-354c584a981b", false);
    test_uuid("84949cc5-4701-4a84-895b0354c584a981b", false);
    test_uuid("g4949cc5-4701-4a84-895b-354c584a981b", false);
    test_uuid("84949cc5-4701-4a84-895b-354c584a981g", false);

    ScUuid_Delete(uuid1);
    ScUuid_Delete(uuid2);
    ScUuid_Delete(uuid3);

    LOG_CLOSE();

    return 0;
}
static void launcher_navigator_applet_finalize(GObject *object)
{
    LauncherNavigatorAppletPrivate *info = LAUNCHER_NAVIGATOR_APPLET_GET_PRIVATE(object);

    osso_deinitialize(info->osso);

    LOG_CLOSE();

    G_OBJECT_CLASS(g_type_class_peek_parent(G_OBJECT_GET_CLASS(object)))->finalize(object);
}
Beispiel #8
0
int main()
{
    char x[100];
    char xe[100];
    sprintf(x, "test.log");
    sprintf(xe, "test.err");
    LOG_INIT(x, xe, 1);
    DEBUG("This is testing debugging message from sample program \n");
    ERROR("Error message from sample program\n");
    LOG_CLOSE();
    return 0;
}
Beispiel #9
0
int main(int argc, char *argv[])
{
	SetConsoleTitle("YTDYDRYDDYFT2TXDDFFCOL");
	if(settings.m_bEnableLog)
		LOG_OPEN();
	
	if (argc > 1)
	{
		printf("argc=%d\n", argc);
		UINT8 i;
		for ( i= 1; i < argc; i++)
		{
			if (argv[i]!=NULL)
				printf("arg%d\t%s\n", i, argv[i]);
		}

		char ext[4];
		i = strlen(argv[1]);
		ext[0] = argv[1][i - 3];
		ext[1] = argv[1][i - 2];
		ext[2] = argv[1][i - 1];
		ext[3] = 0;
		//strcpy(ext, argv[1]+strlen(argv[1]) - 3);
		if (strcmp(ext,"ydr")==0)
		{
			ConvertYDR(argv[1]);
		}

	}
	else{
		LOGL("No arguments. Searching file..");
		LOGL("Searching for ytd...");
		SearchFiles("*.ytd", (LPSEARCHFUNC)ConvertYTD);
		LOGL("Searching for ydr...");
		SearchFiles("*.ydr", (LPSEARCHFUNC)ConvertYDR);
		LOGL("Searching for ydd...");
		SearchFiles("*.ydd", (LPSEARCHFUNC)ConvertYDD);
		LOGL("Searching for yft...");
		SearchFiles("*.yft", (LPSEARCHFUNC)ConvertYFT);

	}

	LOG_CLOSE();
	printf("\nConversion finished.");

	getchar();
	return 1;
}
Beispiel #10
0
int testCode() {
    LOG_INIT_CONSOLE();
    LOG_INIT_FILE();

    func1();
    func2();
    func3();

    int *p = (int*)malloc(sizeof(int));

    LOG_INFO("%d", 1);
    LOG_INFO("%d %d", 1, 2);
    LOG_INFO("%d %d %d", 1, 2, 3);
    LOG_INFO("%s %d %f", "ashish", 2, 3.2);
    LOG_INFO("%s %d %f %u", "ashish", 2, 3.2, p);

    LOG_WARN("%d", 1);
    LOG_WARN("%d %d", 1, 2);
    LOG_WARN("%d %d %d", 1, 2, 3);
    LOG_WARN("%s %d %f", "ashish", 2, 3.2);
    LOG_WARN("%s %d %f %u", "ashish", 2, 3.2, p);

    //LOG_ERROR("%d", 1);
    //LOG_ERROR("%d %d", 1, 2);
    //LOG_ERROR("%d %d %d", 1, 2, 3);
    //LOG_ERROR("%s %d %f", "ashish", 2, 3.2);
    //LOG_ERROR("%s %d %f %u", "ashish", 2, 3.2, p);

    LOG_DEBUG("%d", 1);
    LOG_DEBUG("%d %d", 1, 2);
    LOG_DEBUG("%d %d %d", 1, 2, 3);
    LOG_DEBUG("%s %d %f", "ashish", 2, 3.2);
    LOG_DEBUG("%s %d %f %u", "ashish", 2, 3.2, p);

    LOG_CLOSE();
    return 0;
}
Beispiel #11
0
int
main (int argc, char** argv)
{
	CDServer* server;
	int       opt;
	bool      noFork    = false;
	bool      debugging = false;
	char*     config    = NULL;

	static const char* configSearchPath[] = {
		"%s/.craftd/craftd.conf", // %s is replaced with $HOME
		"/etc/craftd/craftd.conf",
		"/usr/local/etc/craftd/craftd.conf",
		"craftd.conf", // Current working directory (for devs)
		NULL
	};

	CDDefaultLogger = CDConsoleLogger;

	LOG(LOG_INFO, "%s " CRAFTD_NOTICE_MESSAGE, argv[0]);

	while ((opt = getopt(argc, argv, "c:dhnv")) != -1) {
		switch (opt) {
			case 'd': {  // debugging mode
				debugging = true;
			} break;

			case 'v': { // print version
				exit(EXIT_SUCCESS); // Version header already printed
			} break;

			case 'n': { // don't fork or daemonize, use stdout for logging
				noFork = true;
			} break;

			case 'c': { // use the specified config file
				config = optarg;
			} break;

			case 'h': // print help message
			default: {
				fprintf(stderr, "\nUsage: %s [OPTION]...\n"
					"-c <conf file>    specify a conf file location\n"
					"-d                enable verbose debugging messages\n"
					"-h                display this help and exit\n"
					"-n                don't fork/daemonize (overrides config file)\n"
					"-v                output version information and exit\n"
					"\n"
					"For complete documentation, visit the wiki.\n\n", argv[0]);

				exit((opt == 'h') ? EXIT_SUCCESS : EXIT_FAILURE);
			}
		}
	}

	if (!config) {
		char         path[FILENAME_MAX] = { 0 };
		const char** current            = configSearchPath;

		do {
			snprintf(path, FILENAME_MAX, *current, getenv("HOME"));

			current++;
		} while (*current != NULL && !CD_PathExists(path));

		if (!CD_PathExists(path)) {
			CD_abort("The config file could not be found");
		}
		else {
			config = path;
		}
	}

	if (!CD_IsReadable(config)) {
		CD_abort("%s could not be read", config);
	}

	#ifdef WIN32
		evthread_use_windows_threads();
	#else
		evthread_use_pthreads();
	#endif

	if (debugging) {
		evthread_enable_lock_debuging();
	}

	CDMainServer = server = CD_CreateServer(config);

	if (!server) {
		CD_abort("Server couldn't be instantiated");
	}

	/* By default, mask debugging messages */
	if (!debugging) {
		server->logger.setlogmask(LOG_MASK(LOG_DEBUG));
	}

	CD_RunServer(server);

	LOG(LOG_INFO, "Exiting.");
	LOG_CLOSE();

	CD_DestroyServer(server);
}
Beispiel #12
0
int main(int argc, char **argv)
{
    /* open log */
    if (0 != LOG_OPEN("./center", LOG_LEVEL_DEBUG, -1)) {
        fprintf(stderr, "open center log failed!\n");
        return 1;
    }

    if (0 != check_cmd()) {
        return 1;
    }

    /* protobuf verify version */
    GOOGLE_PROTOBUF_VERIFY_VERSION;

    struct event_base *main_base = event_base_new();
    if (NULL == main_base) {
        mfatal("main_base = event_base_new() failed!");
        return 1;
    }

    conn_init();

    /* thread */
    pthread_t worker[WORKER_NUM];
    thread_init(main_base, WORKER_NUM, worker);

    /* signal */
    struct event *signal_event;
    signal_event = evsignal_new(main_base, SIGINT, signal_cb, (void *)main_base);
    if (NULL == signal_event || 0 != event_add(signal_event, NULL)) {
        mfatal("create/add a signal event failed!");
        return 1;
    }

    /* listener for gate */
    struct sockaddr_in sa;
    bzero(&sa, sizeof(sa));
    sa.sin_family = AF_INET;
    sa.sin_addr.s_addr = htonl(INADDR_ANY);
    sa.sin_port = htons(44000);

    listener *lg = listener_new(main_base, (struct sockaddr *)&sa, sizeof(sa), gate_cb);
    if (NULL == lg) {
        mfatal("create client listener failed!");
        return 1;
    }

    /* connector to center */
    struct sockaddr_in csa;
    bzero(&csa, sizeof(csa));
    csa.sin_family = AF_INET;
    csa.sin_addr.s_addr = inet_addr("127.0.0.1");
    csa.sin_port = htons(43001);

    connector *ce = connector_new((struct sockaddr *)&csa, sizeof(csa), center_cb);
    if (NULL == ce) {
        mfatal("create center connector failed!");
        return 1;
    }

    event_base_dispatch(main_base);

    for (int i = 0; i < WORKER_NUM; i++)
        pthread_join(worker[i], NULL);

    connector_free(ce);
    listener_free(lg);
    event_free(signal_event);
    event_base_free(main_base);

    /* shutdown protobuf */
    google::protobuf::ShutdownProtobufLibrary();

    /* close log */
    LOG_CLOSE();

    return 0;
}
int main(int argc, char **argv)
{
	int i, j;
	Graph::VertexWeightedGraph *G;
	TDTree *T=NULL;
	DP_info info;
	list<int> optimal_solution;
    int rank, size;
    double stime, etime;

    int storage_nodes = 1;
    
    MPI_Group orig_group, new_group;

    double leaf_time;
    double nonleaf_time;
    long smem_hwm;
    long rmem_hwm;

    

    MPI_Init (&argc, &argv);
    MPI_Comm_rank (MPI_COMM_WORLD, &rank);
    MPI_Comm_size (MPI_COMM_WORLD, &size);

    // There is a seperate log file for each processor, strictly for
    // debugging and development purposes only.

    char lfname[100];
    char efname[100];
    sprintf (lfname, "parallel_wis-%d.log", rank);
    sprintf (efname, "parallel_wis-error.log", rank);
    //0: debug, 5: critical
    LOG_INIT(lfname, efname, 0);


     if (!(size > storage_nodes + 2))
     {
         FERROR ("No enough processors, please allocate more\n");
         FERROR ("Processor distribution: head_node: %d storage_nodes: %d compute_nodes: %d\n", 1, storage_nodes, size - (storage_nodes + 1));
         MPI_Finalize ();
         exit (0);
     }


	// Process command line options
	int help = info.process_DP_info(argc, argv);
	if(help == -1){
	  if(rank == 0)
	    {
	      usage(argv[0]);
	    } 
	  MPI_Finalize ();
	  exit (1);
	}
	
	// Create the graph for WIS
	create_WIS_graph(&info, G);
	// See if the MIP is to be written/solved
	if(info.write_mod)
	{
		write_ind_set_model(info.DIMACS_file, info.model_file, G);
		if(info.solve_mip)
		{
			// Use GLPSOL to run the MIP solver
			char command_string[100];
			sprintf(command_string,"%s -m %s",GLPSOL,info.model_file);
			fprintf(stderr,"Will use %s to solve MIP. Solution will be written to %s.MIP.WIS.sol",
                    GLPSOL,info.DIMACS_file);
			system(command_string);
		}
		return 1;		
	}
		
	
	// Create the tree decomposition using the options
	create_tree_decomposition(&info, G, &T);
	// Check to see if the DP is to be done
	if(info.decompose_only)
	{
		printf("%s: Treewidth %d\n", info.DIMACS_file, T->width);
		//delete G;
		//delete T;
		return 1;
	}


    T->head_node = 0;
    T->allnodes = new vector<int>(size, -1);
    //T->storage_nodes = new vector<int>(size, -1);
    //T->compute_nodes = new vector<int>(size, -1);

    (*T->allnodes)[0] = HEAD_NODE;
    for (i = 1; i < size; i++)
    {
        if ((storage_nodes > 0) && (i % 4 == 1))
        {
            T->storage_nodes.push_back(i);
            (*T->allnodes)[i] = STORAGE_NODE;
            storage_nodes --;
        }
        else
        {
            T->compute_nodes.push_back(i);
            (*T->allnodes)[i] = COMPUTE_NODE;
        }
    }

    if (MPI_SUCCESS != 
        MPI_Comm_group(MPI_COMM_WORLD, &orig_group))
    {
        FERROR ("MPI Test any failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
        MPI_Finalize();
    }

    if (MPI_SUCCESS != 
        MPI_Group_incl (orig_group, T->compute_nodes.size(), &T->compute_nodes.front(), &new_group))
    {
        FERROR ("MPI Test any failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
        MPI_Finalize();
    }

    MPI_Comm compute_nodes_comm;
    if (MPI_SUCCESS != 
        MPI_Comm_create (MPI_COMM_WORLD, new_group, &compute_nodes_comm))
    {
        FERROR ("MPI Test any failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
        MPI_Finalize();
    }

    T->compute_nodes_comm = &compute_nodes_comm;
    T->storage_nodes_size = T->storage_nodes.size();
    T->compute_nodes_size = T->compute_nodes.size();

    if ((*T->allnodes)[rank] == HEAD_NODE)
    {
        parallel_wis_head_init (T, size, rank);
        parallel_wis_head_start (T);
    }
    else if ((*T->allnodes)[rank] == COMPUTE_NODE)
    {
        parallel_wis_compute_init (T, size, rank);
    }
    else if ((*T->allnodes)[rank] == STORAGE_NODE)
    {
        parallel_wis_storage_init (T, size, rank);
        parallel_wis_storage_start (T);
    }


    if ((*T->allnodes)[T->rank] == COMPUTE_NODE)
    {
        DEBUG("post order walk\n");
        // Create the post_order walk
        vector<int> walk(T->num_tree_nodes,GD_UNDEFINED);
        T->post_order_walk(&walk);

        stime = MPI_Wtime();
        int j;
        DEBUG("starting loop\n");
        for(i = 0; i < T->num_tree_nodes; i++)
        {
            CRIT("processing node : ############# %d\n", walk[i]);
            DEBUG(" %d  more nodes left\n", (T->num_tree_nodes - i));
            T->compute_table(compute_weighted_ind_sets_parallel, walk[i]);
            MPI_Barrier (compute_nodes_comm);

            if(T->info->free_children)
            {
                for(j = 0; (j < T->storage_nodes_size) && (T->rank == T->compute_nodes[0]); j++)
                {
                    if (MPI_SUCCESS !=
                        MPI_Send ((void *)&walk[i], 1, MPI_INT, T->storage_nodes[j], MPI_CHILD_FREE_TAG, MPI_COMM_WORLD))
                    {
                        FERROR ("MPI Irecv failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
                        MPI_Finalize();
                    }
                }
            }
        }

        // Send termination signal to head node to nofity that
        // computation is over for the given tree
        if (MPI_SUCCESS != 
            MPI_Send (&T->rank, 1, MPI_INT, 0, MPI_COMP_TERM_TAG, MPI_COMM_WORLD))
        {
            FERROR ("MPI Send failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
            MPI_Finalize();
        }
        
        // Set flag_recv_done when all tree nodes have been finished then
        // receiving threads can exit.
        T->flag_recv_done = 1;
        
        etime = MPI_Wtime ();
        

        // Store and reset info's table stats 
        info.orig_total_pc_table_entries=info.total_pc_table_entries;
        info.orig_total_table_entries=info.total_table_entries;
        
        info.total_pc_table_entries=info.total_table_entries=0;
        
        
        // Compute some stats here in parent-child intersection to analyze 
        // why memory savings varies across different graphs
        // This is less than ideal, but you have to do it this way for something like make_nice
        // since there are "holes" in the tree_nodes[] array.  The above compute_table() loop
        // gets around this by using the post order walk that is filled with only valid tree node
        // indices!
        
        vector<int> intersection_sizes(T->tree_nodes.size(),-1);
        T->compute_parent_child_intersections(&intersection_sizes);
        info.avg_pc_proportion=0;
        int num_in_avg=0;
        for(i=0;i<(int)T->tree_nodes.size();i++)
        {
            if(T->tree_nodes[i])
            {
                num_in_avg++;
                info.avg_pc_proportion += ((double)intersection_sizes[i]/(double)T->tree_nodes[i]->bag.size());
            }
        }
        info.avg_pc_proportion = info.avg_pc_proportion/(double)num_in_avg;
    }

    smem_hwm = getHWmem();
    if ((*T->allnodes)[rank] == COMPUTE_NODE)
    {
    
        if (MPI_SUCCESS != 
            MPI_Reduce ((void *)&T->info->leaf_time, (void *)&leaf_time, 1, MPI_DOUBLE, MPI_MAX, 0, *T->compute_nodes_comm))
        {
            FERROR ("MPI Reduce failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
            MPI_Finalize();
        }
        T->info->leaf_time = leaf_time;
    
        if (MPI_SUCCESS != 
            MPI_Reduce ((void *)&T->info->nonleaf_time, (void *)&nonleaf_time, 1, MPI_DOUBLE, MPI_MAX, 0, *T->compute_nodes_comm))
        {
            FERROR ("MPI Reduce failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
            MPI_Finalize();
        }
        T->info->nonleaf_time = nonleaf_time;
    
        if (MPI_SUCCESS != 
            MPI_Reduce ((void *)&smem_hwm, (void *)&rmem_hwm, 1, MPI_LONG, MPI_MAX, 0, *T->compute_nodes_comm))
        {
            FERROR ("MPI Reduce failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
            MPI_Finalize();
        }
    
        if (T->rank == T->compute_nodes[0])
            fprintf (stderr, "Memory HWM for all compute nodes: %d\n", rmem_hwm);
    }
    
    if (MPI_SUCCESS != 
        MPI_Reduce ((void *)&smem_hwm, (void *)&rmem_hwm, 1, MPI_LONG, MPI_MAX, 0, MPI_COMM_WORLD))
    {
        FERROR ("MPI Reduce failed at processor : %d %s:%d\n", T->rank, __FILE__, __LINE__);
        MPI_Finalize();
    }

    if (T->rank == 0)
        fprintf (stderr, "Memory HWM for all  nodes: %d\n", rmem_hwm);


    
    if ((*T->allnodes)[rank] == HEAD_NODE)
    {
        parallel_wis_head_cleanup (T);
    }
    else if ((*T->allnodes)[rank] == COMPUTE_NODE)
    {
        parallel_wis_compute_cleanup (T);
    }
    else if ((*T->allnodes)[rank] == STORAGE_NODE)
    {
        parallel_wis_storage_cleanup (T);
    }

    LOG_CLOSE();
    MPI_Finalize();

    if (T->rank == T->compute_nodes[0] )
        print_WIS_results(stdout, T, &info);

  	//delete T;
    //delete &G;
 	return 1;
}
Beispiel #14
0
void emulator_uninit()
{
	LOG_CLOSE();
	papu_uninit();
	video_unint();
}
int csdcsdcmain() {
	LOG_INIT_CONSOLE();
	LOG_INIT_FILE();
	LOG_PROLOG();

	int allocatorNo, nThreads, objSize, iterations, repetitions;
	clock_t start, diff;

	allocatorNo = 1;
	nThreads = 1;
	objSize = 100;
	iterations = 10000;
	repetitions = 1000;


	ThreadData *threadData = (ThreadData*)malloc(nThreads * sizeof(ThreadData));
	pthread_t *threads = (pthread_t*)malloc(sizeof(pthread_t) * nThreads);
	int rc;

	if (allocatorNo == 1) {
		int nBlocks = nThreads * iterations;
		createWaitFreePool(nBlocks, nThreads, iterations, iterations, objSize); // nBlocks, nThreads, chunkSize, donationsSteps

	}
	LOG_INFO("hereeee\n");
	start = clock();
	for (int t = 0; t < nThreads; t++) {
		threadData[t].allocatorNo = allocatorNo;
		threadData[t].nThreads = nThreads;
		threadData[t].objSize = objSize;
		threadData[t].iterations = iterations;
		threadData[t].repetitions = repetitions;
		threadData[t].threadId = t;

		if (allocatorNo == 1) {
			rc = pthread_create((threads + t), NULL, workerWaitFreePool, (threadData + t));
		}

		if (rc) {
			printf("ERROR; return code from pthread_create() is %d", rc);
			exit(-1);
		}
	}

	void *status;
	for (int t = 0; t < nThreads; t++) {
		rc = pthread_join(threads[t], &status);
	}
	diff = clock() - start;
	if (allocatorNo == 1) {
		destroyWaitFreePool();
	}
	int msec = diff * 1000 / CLOCKS_PER_SEC;
	printf("%d", msec);
	free(threadData);

	LOG_EPILOG();
	//printf("Test Client");
	LOG_CLOSE();
	return 0;
}