Add TAMPI emu tests
This commit is contained in:
		
							parent
							
								
									276afd5479
								
							
						
					
					
						commit
						1e2102c0a0
					
				| @ -11,3 +11,4 @@ add_subdirectory(common) | |||||||
| add_subdirectory(ovni) | add_subdirectory(ovni) | ||||||
| add_subdirectory(nosv) | add_subdirectory(nosv) | ||||||
| add_subdirectory(nanos6) | add_subdirectory(nanos6) | ||||||
|  | add_subdirectory(tampi) | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								test/emu/tampi/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								test/emu/tampi/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | # Copyright (c) 2023 Barcelona Supercomputing Center (BSC) | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  | 
 | ||||||
|  | test_emu(ss-comm.c MP) | ||||||
|  | test_emu(ss-polling.c MP) | ||||||
|  | test_emu(ss-mismatch.c SHOULD_FAIL | ||||||
|  |   REGEX "thread [0-9]\\+ ended with 1 stacked tampi subsystems") | ||||||
							
								
								
									
										39
									
								
								test/emu/tampi/instr_tampi.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								test/emu/tampi/instr_tampi.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | |||||||
|  | /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | ||||||
|  |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
|  | 
 | ||||||
|  | #ifndef INSTR_TAMPI_H | ||||||
|  | #define INSTR_TAMPI_H | ||||||
|  | 
 | ||||||
|  | #include "instr.h" | ||||||
|  | 
 | ||||||
|  | INSTR_0ARG(instr_tampi_issue_nonblk_op_enter, "TCi") | ||||||
|  | INSTR_0ARG(instr_tampi_issue_nonblk_op_exit, "TCI") | ||||||
|  | 
 | ||||||
|  | INSTR_0ARG(instr_tampi_check_global_array_enter, "TGc") | ||||||
|  | INSTR_0ARG(instr_tampi_check_global_array_exit, "TGC") | ||||||
|  | 
 | ||||||
|  | INSTR_0ARG(instr_tampi_library_interface_enter, "TLi") | ||||||
|  | INSTR_0ARG(instr_tampi_library_interface_exit, "TLI") | ||||||
|  | INSTR_0ARG(instr_tampi_library_polling_enter, "TLp") | ||||||
|  | INSTR_0ARG(instr_tampi_library_polling_exit, "TLP") | ||||||
|  | 
 | ||||||
|  | INSTR_0ARG(instr_tampi_add_queues_enter, "TQa") | ||||||
|  | INSTR_0ARG(instr_tampi_add_queues_exit, "TQA") | ||||||
|  | INSTR_0ARG(instr_tampi_transfer_queues_enter, "TQt") | ||||||
|  | INSTR_0ARG(instr_tampi_transfer_queues_exit, "TQT") | ||||||
|  | 
 | ||||||
|  | INSTR_0ARG(instr_tampi_completed_request_enter, "TRc") | ||||||
|  | INSTR_0ARG(instr_tampi_completed_request_exit, "TRC") | ||||||
|  | INSTR_0ARG(instr_tampi_test_request_enter, "TRt") | ||||||
|  | INSTR_0ARG(instr_tampi_test_request_exit, "TRT") | ||||||
|  | INSTR_0ARG(instr_tampi_testall_requests_enter, "TRa") | ||||||
|  | INSTR_0ARG(instr_tampi_testall_requests_exit, "TRA") | ||||||
|  | INSTR_0ARG(instr_tampi_testsome_requests_enter, "TRs") | ||||||
|  | INSTR_0ARG(instr_tampi_testsome_requests_exit, "TRS") | ||||||
|  | 
 | ||||||
|  | INSTR_0ARG(instr_tampi_create_ticket_enter, "TTc") | ||||||
|  | INSTR_0ARG(instr_tampi_create_ticket_exit, "TTC") | ||||||
|  | INSTR_0ARG(instr_tampi_wait_ticket_enter, "TTw") | ||||||
|  | INSTR_0ARG(instr_tampi_wait_ticket_exit, "TTW") | ||||||
|  | 
 | ||||||
|  | #endif /* INSTR_TAMPI_H */ | ||||||
							
								
								
									
										55
									
								
								test/emu/tampi/ss-comm.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								test/emu/tampi/ss-comm.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,55 @@ | |||||||
|  | /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | ||||||
|  |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
|  | 
 | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include "compat.h" | ||||||
|  | #include "instr.h" | ||||||
|  | #include "instr_tampi.h" | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | main(void) | ||||||
|  | { | ||||||
|  | 	/* Test that simulates a communication task executing TAMPI operations */ | ||||||
|  | 
 | ||||||
|  | 	const int rank = atoi(getenv("OVNI_RANK")); | ||||||
|  | 	const int nranks = atoi(getenv("OVNI_NRANKS")); | ||||||
|  | 
 | ||||||
|  | 	instr_start(rank, nranks); | ||||||
|  | 
 | ||||||
|  | 	const int ncomms = 100; | ||||||
|  | 
 | ||||||
|  | 	/* Simulate multiple task-aware communications */ | ||||||
|  | 	for (int c = 0; c < ncomms; c++) { | ||||||
|  | 		instr_tampi_library_interface_enter(); | ||||||
|  | 
 | ||||||
|  | 		/* Issue the non-blocking MPI operation and test it */ | ||||||
|  | 		instr_tampi_issue_nonblk_op_enter(); | ||||||
|  | 		sleep_us(100); | ||||||
|  | 		instr_tampi_issue_nonblk_op_exit(); | ||||||
|  | 		instr_tampi_test_request_enter(); | ||||||
|  | 		sleep_us(10); | ||||||
|  | 		instr_tampi_test_request_exit(); | ||||||
|  | 
 | ||||||
|  | 		/* Create a ticket if it was not completed */ | ||||||
|  | 		if (c % 2 == 0) { | ||||||
|  | 			instr_tampi_create_ticket_enter(); | ||||||
|  | 			instr_tampi_create_ticket_exit(); | ||||||
|  | 
 | ||||||
|  | 			instr_tampi_add_queues_enter(); | ||||||
|  | 			instr_tampi_add_queues_exit(); | ||||||
|  | 
 | ||||||
|  | 			/* Wait the ticket if the operation was blocking */ | ||||||
|  | 			if (c % 4 == 0) { | ||||||
|  | 				instr_tampi_wait_ticket_enter(); | ||||||
|  | 				sleep_us(100); | ||||||
|  | 				instr_tampi_wait_ticket_exit(); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		instr_tampi_library_interface_exit(); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	instr_end(); | ||||||
|  | 
 | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
							
								
								
									
										23
									
								
								test/emu/tampi/ss-mismatch.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								test/emu/tampi/ss-mismatch.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | ||||||
|  |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
|  | 
 | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include "compat.h" | ||||||
|  | #include "instr.h" | ||||||
|  | #include "instr_tampi.h" | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | main(void) | ||||||
|  | { | ||||||
|  | 	/* Test that a thread ending while the subsystem still has a value in
 | ||||||
|  | 	 * the stack causes the emulator to fail */ | ||||||
|  | 
 | ||||||
|  | 	instr_start(0, 1); | ||||||
|  | 
 | ||||||
|  | 	instr_tampi_library_interface_enter(); | ||||||
|  | 	/* The thread is left in the library interface state (should fail) */ | ||||||
|  | 
 | ||||||
|  | 	instr_end(); | ||||||
|  | 
 | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
							
								
								
									
										69
									
								
								test/emu/tampi/ss-polling.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								test/emu/tampi/ss-polling.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,69 @@ | |||||||
|  | /* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
 | ||||||
|  |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
|  | 
 | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include "compat.h" | ||||||
|  | #include "instr.h" | ||||||
|  | #include "instr_tampi.h" | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | main(void) | ||||||
|  | { | ||||||
|  | 	/* Test that simulates the polling task of TAMPI */ | ||||||
|  | 
 | ||||||
|  | 	const int rank = atoi(getenv("OVNI_RANK")); | ||||||
|  | 	const int nranks = atoi(getenv("OVNI_NRANKS")); | ||||||
|  | 
 | ||||||
|  | 	instr_start(rank, nranks); | ||||||
|  | 
 | ||||||
|  | 	const int transfer_step = 5; | ||||||
|  | 	const int complete_step = 3; | ||||||
|  | 
 | ||||||
|  | 	int nreqs_to_transfer = 100; | ||||||
|  | 	int nreqs_to_test = 0; | ||||||
|  | 	int t, c; | ||||||
|  | 
 | ||||||
|  | 	/* Simulate the loop of the polling task */ | ||||||
|  | 	while (nreqs_to_transfer || nreqs_to_test) { | ||||||
|  | 		instr_tampi_library_polling_enter(); | ||||||
|  | 
 | ||||||
|  | 		t = 0; | ||||||
|  | 		instr_tampi_transfer_queues_enter(); | ||||||
|  | 		while (nreqs_to_transfer && t < transfer_step) { | ||||||
|  | 			/* Transfer a request/ticket to the global array */ | ||||||
|  | 			--nreqs_to_transfer; | ||||||
|  | 			++nreqs_to_test; | ||||||
|  | 			++t; | ||||||
|  | 		} | ||||||
|  | 		instr_tampi_transfer_queues_exit(); | ||||||
|  | 
 | ||||||
|  | 		/* Check the global array of requests/tickets */ | ||||||
|  | 		if (nreqs_to_test) { | ||||||
|  | 			instr_tampi_check_global_array_enter(); | ||||||
|  | 
 | ||||||
|  | 			/* Testsome requests */ | ||||||
|  | 			instr_tampi_testsome_requests_enter(); | ||||||
|  | 			sleep_us(10); | ||||||
|  | 			instr_tampi_testsome_requests_exit(); | ||||||
|  | 
 | ||||||
|  | 			c = 0; | ||||||
|  | 			while (nreqs_to_test && c < complete_step) { | ||||||
|  | 				/* Process a completed request */ | ||||||
|  | 				instr_tampi_completed_request_enter(); | ||||||
|  | 				sleep_us(1); | ||||||
|  | 				instr_tampi_completed_request_exit(); | ||||||
|  | 				--nreqs_to_test; | ||||||
|  | 				++c; | ||||||
|  | 			} | ||||||
|  | 			instr_tampi_check_global_array_exit(); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		instr_tampi_library_polling_exit(); | ||||||
|  | 
 | ||||||
|  | 		sleep_us(100); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	instr_end(); | ||||||
|  | 
 | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Kevin Sala
						Kevin Sala