int
main (int argc, char **argv)
{
	int ret;
	SRunner *sr;
	Suite *s;

	/* init stuff */
	rb_profile_start ("rhythmdb-query-model test suite");

	rb_threads_init ();
	setlocale (LC_ALL, NULL);
	rb_debug_init (TRUE);
	rb_refstring_system_init ();
	rb_file_helpers_init (TRUE);

	/* setup tests */
	s = rhythmdb_query_model_suite ();
	sr = srunner_create (s);

	init_setup (sr, argc, argv);
	init_once (FALSE);

	srunner_run_all (sr, CK_NORMAL);
	ret = srunner_ntests_failed (sr);
	srunner_free (sr);


	rb_file_helpers_shutdown ();
	rb_refstring_system_shutdown ();

	rb_profile_end ("rhythmdb-query-model test suite");
	return ret;
}
int
main (int argc, char **argv)
{
	int ret;
	SRunner *sr;
	Suite *s;

	rb_profile_start ("rb-file-helpers test suite");
	g_thread_init (NULL);
	rb_threads_init ();
	setlocale (LC_ALL, NULL);
	rb_debug_init (TRUE);
	rb_file_helpers_init (TRUE);

	/* setup tests */
	s = rb_file_helpers_suite ();
	sr = srunner_create (s);

	init_setup (sr, argc, argv);
	init_once (FALSE);

	srunner_run_all (sr, CK_NORMAL);
	ret = srunner_ntests_failed (sr);
	srunner_free (sr);

	rb_file_helpers_shutdown ();

	rb_profile_end ("rb-file-helpers test suite");
	return ret;
}
int
main (int argc, char **argv)
{
	int ret;
	SRunner *sr;
	Suite *s;

	g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL);

	rb_threads_init ();
	rb_debug_init (TRUE);
	rb_refstring_system_init ();
	rb_file_helpers_init (TRUE);

	/* setup tests */
	s = rb_query_creator_suite ();
	sr = srunner_create (s);

	init_setup (sr, argc, argv);
	init_once (FALSE);
	
	srunner_run_all (sr, CK_NORMAL);
	ret = srunner_ntests_failed (sr);
	srunner_free (sr);

	rb_file_helpers_shutdown ();
	rb_refstring_system_shutdown ();

	return ret;
}
TEST(BasicSial,DISABLED_exit_statement_test) {
    std::string job("exit_statement_test");
    sip::DataManager::scope_count=0;
    double x = 3.456;
    double y = -0.1;
    int norb = 3;
    {
        init_setup(job.c_str());
        set_scalar("x",x);
        set_scalar("y",y);
        set_constant("norb",norb);
        std::string tmp = job + ".siox";
        const char* nm= tmp.c_str();
        add_sial_program(nm);
        int segs[]  = {2,3,4,2,3,4,2,3,4,2,3,4,2,3,4};
        set_aoindex_info(15,segs);
        finalize_setup();
    }
    std::stringstream output;
    TestControllerParallel controller(job, true, VERBOSE_TEST, "", output);
    controller.initSipTables();
    controller.run();
    if(attr->is_worker()) {
        EXPECT_DOUBLE_EQ(12, controller.int_value("counter_j"));
        EXPECT_DOUBLE_EQ(4, controller.int_value("counter_i"));
        EXPECT_EQ(0, sip::DataManager::scope_count);
        EXPECT_TRUE(controller.worker_->all_stacks_empty());
        EXPECT_EQ(0, controller.worker_->num_blocks_in_blockmap());
    }
}
Exemple #5
0
TEST(Sial,persistent_distributed_array_mpi){
	std::string job("persistent_distributed_array_mpi");
	double x = 3.456;
	int norb = 2;
	int segs[]  = {2,3};

	if (attr->global_rank() == 0){
		init_setup(job.c_str());
		set_scalar("x",x);
		set_constant("norb",norb);
		std::string tmp = job + "1.siox";
		const char* nm= tmp.c_str();
		add_sial_program(nm);
		std::string tmp1 = job + "2.siox";
		const char* nm1= tmp1.c_str();
		add_sial_program(nm1);
		set_aoindex_info(2,segs);
		finalize_setup();
	}


	std::stringstream output;
	TestControllerParallel controller(job, true, true, "", output);

	//run first program
	controller.initSipTables();
	controller.run();
	controller.print_timers(std::cout);
	std::cout << "Rank " << attr->global_rank() << " in persistent_distributed_array_mpi starting second program" << std::endl << std::flush;

	//run second program
	controller.initSipTables();
	controller.run();
	if (attr->is_worker()) {
		int i,j;
		for (i=1; i <= norb ; ++i ){
			for (j = 1; j <= norb; ++j){
			    double firstval = (i-1)*norb + j;
			    std::vector<int> indices;
			    indices.push_back(i);
			    indices.push_back(j);
			    double * block_data = controller.local_block(std::string("a"),indices);
			    size_t block_size = segs[i-1] * segs[j-1];
			    for (size_t count = 0; count < block_size; ++count){
			    	ASSERT_DOUBLE_EQ(3*firstval, block_data[count]);
			    	firstval++;
			    }
			}
		}
	}
	controller.print_timers(std::cout);

}
Exemple #6
0
void OpenIBootStart()
{
	platform_init();
	init_setup();

	OpenIBootMain = &OpenIBootConsole;
	init_boot_modules();

	OpenIBootMain();

	tasks_run(); // Runs forever.
}
Exemple #7
0
void basic_pardo_test(int max_dims, int lower[], int upper[],
		bool expect_success = true) {
	assert(max_dims <= 6);
	for (int num_dims = 1; num_dims <= 6; ++num_dims) {
		std::stringstream job_ss;
		job_ss << "pardo_loop_" << num_dims << "d";
		std::string job = job_ss.str();

		//total number of iters for this sial program
		int num_iters = 1;
		for (int j = 0; j < num_dims; ++j) {
			num_iters *= ((upper[j] - lower[j]) + 1);
		}

		//create .dat file
		if (attr->global_rank() == 0) {
			init_setup(job.c_str());
			//add values for upper and lower bounds
			for (int i = 0; i < num_dims; ++i) {
				std::stringstream lower_ss, upper_ss;
				lower_ss << "lower" << i;
				upper_ss << "upper" << i;
				set_constant(lower_ss.str().c_str(), lower[i]);
				set_constant(upper_ss.str().c_str(), upper[i]);
			}
			std::string tmp = job + ".siox";
			const char* nm = tmp.c_str();
			add_sial_program(nm);
			finalize_setup();
		}

		TestControllerParallel controller(job, true, VERBOSE_TEST,
				"This is a test of " + job, std::cout, expect_success);
		controller.initSipTables();
		controller.run();
		if (attr->global_rank() == 0) {
			double total = controller.worker_->scalar_value("total");
			if (VERBOSE_TEST) {
				std::cout << "num_iters=" << num_iters << ", total=" << total
						<< std::endl;
			}
			EXPECT_EQ(num_iters, int(total));
		}
	}
}
Exemple #8
0
Setup *fill_setup(Image *image, char *setupfile, int usefile, int autopars)
{
  int no_error=1;     /* Flag set to 0 on error */
  Setup *setup=NULL;  /* Container for plotting parameters */

  /*
   * Allocate memory for Setup container
   */

  if(!(setup = new_setup(1))) {
    fprintf(stderr,"ERROR: fill_setup\n");
    return NULL;
  }

  /*
   * Set up image display parameters
   */

  if(no_error)
    if(set_setup_defaults(image,setup))
      no_error = 0;

  if(autopars) 
    if(init_setup(image,setup,autopars))
      no_error = 0;

  if(no_error && usefile)
    if(setup_file(image,setup,setupfile))
      no_error = 0;

  if(no_error)
    setup_interact(image,setup);

  /*
   * Return filled setup container if no errors
   */

  if(no_error)
    return setup;
  else {
    fprintf(stderr,"ERROR: fill_setup\n");
    return del_setup(setup);
  }
}
Exemple #9
0
TEST(Sial,get_mpi){
	std::string job("get_mpi");
	//create setup_file
	double x = 3.456;
	int norb = 4;
	int segs[]  = {2,3,4,1};

	if (attr->global_rank() == 0){
		init_setup(job.c_str());
		set_scalar("x",x);
		set_constant("norb",norb);
		std::string tmp = job + ".siox";
		const char* nm= tmp.c_str();
		add_sial_program(nm);
		set_aoindex_info(4,segs);
		finalize_setup();
	}

	std::stringstream output;
	TestControllerParallel controller(job, true, VERBOSE_TEST, "", output);
	controller.initSipTables();
	controller.run();

	if(attr->global_rank()==0){
		// Test a(1,1)
		// Get the data for local array block "b"
		int a_slot = controller.worker_->array_slot(std::string("a"));

		sip::index_selector_t a_indices_1;
		a_indices_1[0] = 1; a_indices_1[1] = 1;
		for (int i = 2; i < MAX_RANK; i++) a_indices_1[i] = sip::unused_index_value;
		sip::BlockId a_bid_1(a_slot, a_indices_1);
		std::cout << a_bid_1 << std::endl;
		sip::Block::BlockPtr a_bptr_1 = controller.worker_->get_block_for_reading(a_bid_1);
		sip::Block::dataPtr a_data_1 = a_bptr_1->get_data();
		std::cout << " Comparing block " << a_bid_1 << std::endl;
		for (int i=0; i<segs[0]; i++){
			for (int j=0; j<segs[0]; j++){
				ASSERT_DOUBLE_EQ(42*3, a_data_1[i*segs[0] + j]);
			}
		}
	}
}
TEST(Sial,put_test) {
    barrier();
    std::string job("put_test");
    int norb = 3;
    int segs[] = {2,3,2};
    if (attr->global_rank() == 0) {
        init_setup(job.c_str());
        set_constant("norb", norb);
        set_constant("norb_squared", norb*norb);
        std::string tmp = job + ".siox";
        const char* nm = tmp.c_str();
        add_sial_program(nm);
        set_aoindex_info(3, segs);
        finalize_setup();
    }
    barrier();
    std::stringstream output;
    TestControllerParallel controller(job, true, VERBOSE_TEST, " ", output);
    controller.initSipTables();
    if (attr->is_worker()) {
        std::cout << "creating and starting a worker" << std::endl << std::flush;
        controller.runWorker();
        EXPECT_TRUE(controller.worker_->all_stacks_empty());
        std::vector<int> index_vec;
        for (int i = 0; i < norb; ++i) {
            for (int j = 0; j < norb; ++j) {
                int k = (i*norb + j)+1;
                index_vec.push_back(k);
                double * local_block = controller.local_block("result",index_vec);
                double value = local_block[0];
                double expected = k*k*segs[i]*segs[j];
                std::cout << "k,value= " << k << " " << value << std::endl;
                ASSERT_DOUBLE_EQ(expected, value);
                index_vec.clear();
            }
        }
    } else {
        std::cout << "creating and starting a server" << std::endl << std::flush;
        controller.runServer();
    }


}
Exemple #11
0
TEST(Sial,empty){
	std::string job("empty");
	int norb = 3;
        int segs[] = {2,2,2};
	if (attr->global_rank() == 0) {
		init_setup(job.c_str());
		std::string tmp = job + ".siox";
		const char* nm = tmp.c_str();
		add_sial_program(nm);
		set_aoindex_info(3, segs);
		finalize_setup();
	}
	std::stringstream output;

	TestControllerParallel controller(job, true, VERBOSE_TEST, "", output);
	controller.initSipTables();
	controller.run();

}
Exemple #12
0
/* TODO check what this test does.  */
TEST(Sip,message_number_wraparound){

	std::string job("message_number_wraparound_test");

	if (attr->global_rank() == 0){
		init_setup(job.c_str());
		set_constant("norb",1);
		std::string tmp = job + ".siox";
		const char* nm= tmp.c_str();
		add_sial_program(nm);
		int segs[]  = {1};
		set_aoindex_info(1,segs);
		finalize_setup();
	}

	std::stringstream output;
	TestControllerParallel controller(job, true, VERBOSE_TEST, "", output);
	controller.initSipTables();
	controller.run();
}
Exemple #13
0
TEST(Sial,persistent_scalars) {
	std::string job("persistent_scalars");
	double x = 3.456;
	double y = -0.1;

	{
		init_setup(job.c_str());
		set_scalar("x", x);
		set_scalar("y", y);
		std::string tmp1 = job + "_1.siox";
		const char* nm1 = tmp1.c_str();
		add_sial_program(nm1);
		std::string tmp2 = job + "_2.siox";
		const char* nm2 = tmp2.c_str();
		add_sial_program(nm2);
		finalize_setup();
	}

	std::stringstream output;
	TestControllerParallel controller(job, true, VERBOSE_TEST, "", output);
	controller.initSipTables();
	controller.run();
	if (attr->is_worker()) {
		ASSERT_DOUBLE_EQ(y, scalar_value("y"));
		ASSERT_DOUBLE_EQ(x, scalar_value("z"));
		ASSERT_DOUBLE_EQ(99.99, scalar_value("zz"));

		std::cout << "wpam:" << std::endl << *controller.wpam_ << std::endl
				<< "%%%%%%%%%%%%" << std::endl;
	}

	//Now do the second program
	//get siox name from setup, load and print the sip tables
	controller.initSipTables();
	controller.run();
	if (attr->is_worker()) {
		ASSERT_DOUBLE_EQ(x + 1, scalar_value("x"));
		ASSERT_DOUBLE_EQ(y, scalar_value("y"));
		ASSERT_DOUBLE_EQ(6, scalar_value("e"));
	}
}
Exemple #14
0
TEST(Sial,put_accumulate_mpi){
	std::string job("put_accumulate_mpi");
	double x = 3.456;
	int norb = 4;
	if (attr->global_rank() == 0){
		init_setup(job.c_str());
		set_scalar("x",x);
		set_constant("norb",norb);
		std::string tmp = job + ".siox";
		const char* nm= tmp.c_str();
		add_sial_program(nm);
		int segs[]  = {2,3,4,1};
		set_aoindex_info(4,segs);
		finalize_setup();
	}
	std::stringstream output;
	TestControllerParallel controller(job, true, VERBOSE_TEST, "", output);
	controller.initSipTables();
	controller.run();

}
Exemple #15
0
int main(int argc, LPSTR argv[])
{
	DWORD dwRet, i;
	HANDLE hFile;

	if (argc != 2) {
		printf("Usage: %s file_with_numbers\n", argv[0]);
		ExitProcess(0);
	}

	hFile = init_setup(argv[1]);
	
	/* Wait for the merging to finish */
	dwRet = WaitForSingleObject(threads[0], INFINITE);
	DIE(dwRet == WAIT_FAILED, "WaitForSingleObject main");

	printf("Threading part done\n");

	for (i = 0; i < NO_THREADS; i++) {
		dwRet = CloseHandle(threads[i]);
		DIE(dwRet == FALSE, "CloseHandle");
	}

	/* Check if numbers are sorted */
	print_mem(thData[0].lpChunk->lpMem, thData[0].lpChunk->dwLen);
	for (i = 0; i < N-1; i++){
		if (thData[0].lpChunk->lpMem[i] > thData[0].lpChunk->lpMem[i+1])
			printf("Check failed - found %d before %d \n", thData[0].lpChunk->lpMem[i], thData[0].lpChunk->lpMem[i+1]);
	}

	printf("All done. Cleaning... \n");

	dwRet = UnmapViewOfFile(pmap);
	DIE(dwRet == FALSE, "UnmapViewOfFile");

	dwRet = CloseHandle(hFile);
	DIE(dwRet == FALSE, "CloseHandle");

	ExitProcess(0);
}
Exemple #16
0
TEST(Sial,all_rank_print){
	std::string job("all_rank_print_test");
	std::cout << "JOBNAME = " << job << std::endl;
	double x = 3.456;
	int norb = 2;
	if (attr->global_rank() == 0){
		init_setup(job.c_str());
		set_scalar("x",x);
		set_constant("norb",norb);
		std::string tmp = job + ".siox";
		const char* nm= tmp.c_str();
		add_sial_program(nm);
		int segs[]  = {2,3};
		set_aoindex_info(2,segs);
		finalize_setup();
	}

	std::stringstream output;
	TestControllerParallel controller(job, true, VERBOSE_TEST, "", output);
	controller.initSipTables();
	controller.run();
}
Exemple #17
0
TEST(Sial,broadcast_static){
	std::string job("broadcast_static");
	int norb = 3;
	int segs[] = {2,3,2};
	int root = 0;
	if (attr->global_rank() == 0) {
		init_setup(job.c_str());
		set_constant("norb", norb);
		set_constant("root", root);
		std::string tmp = job + ".siox";
		const char* nm = tmp.c_str();
		add_sial_program(nm);
		set_aoindex_info(3, segs);
		finalize_setup();
	}
	std::stringstream output;

	TestControllerParallel controller(job, true, VERBOSE_TEST, "", output);
	controller.initSipTables();
	controller.run();
	if (attr->is_worker()) {
	double * a = controller.static_array("a");
	int expected[] = {1, 2, 1, 2, 3, 1, 2,
			3, 4, 4, 5, 6, 3, 4,
			1, 2, 1, 2, 3, 1, 2,
			3, 4, 4, 5, 6, 3, 4,
			5, 6, 7, 8, 9, 5, 6,
			1, 2, 1, 2, 3, 1, 2,
			3, 4, 4, 5, 6, 3, 4};
	int side = 2+3+2; //size of one side, from seg sizes in segs array above
	int size = side*side;
	int i = 0;
	for (i; i < size; ++i){
		ASSERT_DOUBLE_EQ(expected[i], a[i]);
	}
}

}
Exemple #18
0
//@@***********************************************************************************@@
int main(int argc, char **argv)
{
	glutInit(&argc, argv);

	init_setup(WINDOW_XS, WINDOW_YS, WINDOW_NAME);
	
	// Initialize the values of the tree
	pointAry[0].x = 237;
	pointAry[0].y = 12;
	pointAry[1].x = 362;
	pointAry[1].y = 12;
	pointAry[2].x = 302;
	pointAry[2].y = 12;
	pointAry[3].x = 302;
	pointAry[3].y = 587;
	pointAry[4].x = 302;
	pointAry[4].y = 92;
	pointAry[5].x = 12;
	pointAry[5].y = 62;
	pointAry[6].x = 12;
	pointAry[6].y = 82;
	pointAry[7].x = 107;
	pointAry[7].y = 72;
	pointAry[8].x = 302;
	pointAry[8].y = 92;
	pointAry[9].x = 587;
	pointAry[9].y = 62;
	pointAry[10].x = 587;
	pointAry[10].y = 82;
	pointAry[11].x = 492;
	pointAry[11].y = 72;
	pointAry[12].x = 302;
	pointAry[12].y = 177;
	pointAry[13].x = 72;
	pointAry[13].y = 127;
	pointAry[14].x = 142;
	pointAry[14].y = 142;
	pointAry[15].x = 72;
	pointAry[15].y = 157;
	pointAry[16].x = 302;
	pointAry[16].y = 177;
	pointAry[17].x = 527;
	pointAry[17].y = 127;
	pointAry[18].x = 457;
	pointAry[18].y = 142;
	pointAry[19].x = 527;
	pointAry[19].y = 157;
	pointAry[20].x = 302;
	pointAry[20].y = 337;
	pointAry[21].x = 152;
	pointAry[21].y = 187;
	pointAry[22].x = 202;
	pointAry[22].y = 237;
	pointAry[23].x = 152;
	pointAry[23].y = 287;
	pointAry[24].x = 302;
	pointAry[24].y = 337;
	pointAry[25].x = 452;
	pointAry[25].y = 187;
	pointAry[26].x = 402;
	pointAry[26].y = 237;
	pointAry[27].x = 452;
	pointAry[27].y = 287;
	pointAry[28].x = 302;
	pointAry[28].y = 487;
	pointAry[29].x = 207;
	pointAry[29].y = 307;
	pointAry[30].x = 237;
	pointAry[30].y = 362;
	pointAry[31].x = 207;
	pointAry[31].y = 417;
	pointAry[32].x = 302;
	pointAry[32].y = 487;
	pointAry[33].x = 387;
	pointAry[33].y = 307;
	pointAry[34].x = 362;
	pointAry[34].y = 362;
	pointAry[35].x = 387;
	pointAry[35].y = 417;
	pointAry[36].x = 302;
	pointAry[36].y = 587;
	pointAry[37].x = 237;
	pointAry[37].y = 487;
	pointAry[38].x = 257;
	pointAry[38].y = 517;
	pointAry[39].x = 237;
	pointAry[39].y = 547;
	pointAry[40].x = 302;
	pointAry[40].y = 587;
	pointAry[41].x = 367;
	pointAry[41].y = 487;
	pointAry[42].x = 347;
	pointAry[42].y = 517;
	pointAry[43].x = 367;
	pointAry[43].y = 547;

	currPoint = -1;
	
	glutDisplayFunc(display_func);			// call back for display event
	glutKeyboardFunc(keyboard_func);		// call back for keyboard event
	glutMouseFunc(mouse_func);				// call back for mouse event

	glutMainLoop();							

	return 1;
}	// end of main()
TEST(SimpleMPI,persistent_distributed_array_mpi) {

    sip::GlobalState::reset_program_count();
    sip::SIPMPIAttr &sip_mpi_attr = sip::SIPMPIAttr::get_instance();
    int my_rank = sip_mpi_attr.global_rank();

    std::cout << "****************************************\n";
    sip::DataManager::scope_count=0;
    //create setup_file
    std::string job("persistent_distributed_array_mpi");
    std::cout << "JOBNAME = " << job << std::endl;
    double x = 3.456;
    int norb = 2;
    int segs[]  = {2,3};


    if (attr.global_rank() == 0) {
        init_setup(job.c_str());
        set_scalar("x",x);
        set_constant("norb",norb);
        std::string tmp = job + "1.siox";
        const char* nm= tmp.c_str();
        add_sial_program(nm);
        std::string tmp1 = job + "2.siox";
        const char* nm1= tmp1.c_str();
        add_sial_program(nm1);
        set_aoindex_info(2,segs);
        finalize_setup();
    }

    sip::SIPMPIUtils::check_err(MPI_Barrier(MPI_COMM_WORLD));

    setup::BinaryInputFile setup_file(job + ".dat");
    setup::SetupReader setup_reader(setup_file);

    std::cout << "SETUP READER DATA:\n" << setup_reader<< std::endl;


    //get siox name from setup, load and print the sip tables
    std::string prog_name = setup_reader.sial_prog_list_.at(0);
    std::string siox_dir(dir_name);
    setup::BinaryInputFile siox_file(siox_dir + prog_name);
    sip::SipTables sipTables(setup_reader, siox_file);
    if (!sip_mpi_attr.is_server()) {
        std::cout << "SIP TABLES" << '\n' << sipTables << std::endl;
    }

    if (sip_mpi_attr.global_rank()==0) {
        std::cout << "\n\n\n\n>>>>>>>>>>>>starting SIAL PROGRAM  "<< job << std::endl;
    }

    //create worker and server
    sip::DataDistribution data_distribution(sipTables, sip_mpi_attr);
    sip::GlobalState::set_program_name(prog_name);
    sip::GlobalState::increment_program();
    sip::WorkerPersistentArrayManager wpam;
    sip::ServerPersistentArrayManager spam;

    std::cout << "rank " << my_rank << " reached first barrier" << std::endl << std::flush;
    MPI_Barrier(MPI_COMM_WORLD);
    std::cout << "rank " << my_rank << " passed first barrier" << std::endl << std::flush;

    if (sip_mpi_attr.is_server()) {
        sip::SIPServer server(sipTables, data_distribution, sip_mpi_attr, &spam);
        std::cout << "at first barrier in prog 1 at server" << std::endl << std::flush;
        MPI_Barrier(MPI_COMM_WORLD);
        std::cout<<"passed first barrier at server, starting server" << std::endl;
        server.run();
        spam.save_marked_arrays(&server);
        std::cout << "Server state after termination" << server << std::endl;
    } else {
        sip::SialxTimer sialxTimer(sipTables.max_timer_slots());
        sip::Interpreter runner(sipTables, sialxTimer,  &wpam);
        std::cout << "at first barrier in prog 1 at worker" << std::endl << std::flush;
        MPI_Barrier(MPI_COMM_WORLD);
        std::cout << "after first barrier; starting worker for "<< job  << std::endl;
        runner.interpret();
        wpam.save_marked_arrays(&runner);
        std::cout << "\n end of prog1 at worker"<< std::endl;

    }

    std::cout << std::flush;
    if (sip_mpi_attr.global_rank()==0) {
        std::cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << std::endl << std::flush;
        std::cout << "SETUP READER DATA FOR SECOND PROGRAM:\n" << setup_reader<< std::endl;
    }

    std::string prog_name2 = setup_reader.sial_prog_list_.at(1);
    setup::BinaryInputFile siox_file2(siox_dir + prog_name2);
    sip::SipTables sipTables2(setup_reader, siox_file2);

    if (sip_mpi_attr.global_rank()==0) {
        std::cout << "SIP TABLES FOR " << prog_name2 << '\n' << sipTables2 << std::endl;
    }

    sip::DataDistribution data_distribution2(sipTables2, sip_mpi_attr);
    sip::GlobalState::set_program_name(prog_name);
    sip::GlobalState::increment_program();
    std::cout << "rank " << my_rank << " reached second barrier in test" << std::endl << std::flush;
    MPI_Barrier(MPI_COMM_WORLD);
    std::cout << "rank " << my_rank << " passed second barrier in test" << std::endl << std::flush;

    if (sip_mpi_attr.is_server()) {
        sip::SIPServer server(sipTables2, data_distribution2, sip_mpi_attr, &spam);
        std::cout << "barrier in prog 2 at server" << std::endl << std::flush;
        MPI_Barrier(MPI_COMM_WORLD);
        std::cout<< "rank " << my_rank << "starting server for prog 2" << std::endl;
        server.run();
        std::cout<< "rank " << my_rank  << "Server state after termination of prog2" << server << std::endl;
    } else {
        sip::SialxTimer sialxTimer2(sipTables2.max_timer_slots());
        sip::Interpreter runner(sipTables2, sialxTimer2,  &wpam);
        std::cout << "rank " << my_rank << "barrier in prog 2 at worker" << std::endl << std::flush;
        MPI_Barrier(MPI_COMM_WORLD);
        std::cout << "rank " << my_rank << "starting worker for prog2"<< job  << std::endl;
        runner.interpret();
        std::cout << "\nSIAL PROGRAM 2 TERMINATED"<< std::endl;


        // Test contents of blocks of distributed array "b"

        // Get the data for local array block "b"
        int b_slot = runner.array_slot(std::string("lb"));

        // Test b(1,1)
        sip::index_selector_t b_indices_1;
        b_indices_1[0] = 1;
        b_indices_1[1] = 1;
        for (int i = 2; i < MAX_RANK; i++) b_indices_1[i] = sip::unused_index_value;
        sip::BlockId b_bid_1(b_slot, b_indices_1);
        std::cout << b_bid_1 << std::endl;
        sip::Block::BlockPtr b_bptr_1 = runner.get_block_for_reading(b_bid_1);
        sip::Block::dataPtr b_data_1 = b_bptr_1->get_data();
        std::cout << " Comparing block " << b_bid_1 << std::endl;
        double fill_seq_1_1 = 1.0;
        for (int i=0; i<segs[0]; i++) {
            for (int j=0; j<segs[0]; j++) {
                ASSERT_DOUBLE_EQ(fill_seq_1_1, b_data_1[i*segs[0] + j]);
                fill_seq_1_1++;
            }
        }

        // Test b(2, 2)
        sip::index_selector_t b_indices_2;
        b_indices_2[0] = 2;
        b_indices_2[1] = 2;
        for (int i = 2; i < MAX_RANK; i++) b_indices_2[i] = sip::unused_index_value;
        sip::BlockId b_bid_2(b_slot, b_indices_2);
        std::cout << b_bid_2 << std::endl;
        sip::Block::BlockPtr b_bptr_2 = runner.get_block_for_reading(b_bid_2);
        sip::Block::dataPtr b_data_2 = b_bptr_2->get_data();
        std::cout << " Comparing block " << b_bid_2 << std::endl;
        double fill_seq_2_2 = 4.0;
        for (int i=0; i<segs[1]; i++) {
            for (int j=0; j<segs[1]; j++) {
                ASSERT_DOUBLE_EQ(fill_seq_2_2, b_data_2[i*segs[1] + j]);
                fill_seq_2_2++;
            }
        }

        // Test b(2,1)
        sip::index_selector_t b_indices_3;
        b_indices_3[0] = 2;
        b_indices_3[1] = 1;
        for (int i = 2; i < MAX_RANK; i++) b_indices_3[i] = sip::unused_index_value;
        sip::BlockId b_bid_3(b_slot, b_indices_3);
        std::cout << b_bid_3 << std::endl;
        sip::Block::BlockPtr b_bptr_3 = runner.get_block_for_reading(b_bid_3);
        sip::Block::dataPtr b_data_3 = b_bptr_3->get_data();
        std::cout << " Comparing block " << b_bid_3 << std::endl;
        double fill_seq_2_1 = 3.0;
        for (int i=0; i<segs[1]; i++) {
            for (int j=0; j<segs[0]; j++) {
                ASSERT_DOUBLE_EQ(fill_seq_2_1, b_data_3[i*segs[0] + j]);
                fill_seq_2_1++;
            }
        }


    }

    std::cout << "rank " << my_rank << " reached third barrier in test" << std::endl << std::flush;
    MPI_Barrier(MPI_COMM_WORLD);
    std::cout << "rank " << my_rank << " passed third barrier in test" << std::endl << std::flush;

}