Split sources into src/emu and src/rt
The public includes are now in include/ and in internal includes in src/include/. The ovni* tools are moved to emu/ovni*.c and liked with the emu static library.
This commit is contained in:
		
							parent
							
								
									877bbcd9de
								
							
						
					
					
						commit
						5404cc5e83
					
				| @ -67,6 +67,7 @@ if (NOT HAVE_CLOCK_GETTIME) | ||||
|   endif() | ||||
| endif() | ||||
| 
 | ||||
| add_subdirectory(include) | ||||
| add_subdirectory(src) | ||||
| 
 | ||||
| include(CTest) | ||||
|  | ||||
							
								
								
									
										6
									
								
								include/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								include/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| # Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC) | ||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||
| 
 | ||||
| include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||||
| 
 | ||||
| install(FILES ovni.h DESTINATION include) | ||||
| @ -1,69 +1,13 @@ | ||||
| # Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC) | ||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||
| 
 | ||||
| add_library(ovni SHARED | ||||
|   ovni.c | ||||
|   parson.c | ||||
| ) | ||||
| add_subdirectory(include) | ||||
| 
 | ||||
| set_target_properties(ovni PROPERTIES | ||||
|   VERSION 1.0.0 | ||||
|   SOVERSION 1) | ||||
| 
 | ||||
| target_include_directories(ovni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||||
| add_library(parson STATIC parson.c) | ||||
| target_include_directories(parson PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") | ||||
| 
 | ||||
| configure_file("config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) | ||||
| include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||||
| 
 | ||||
| add_executable(ovniemu | ||||
|   chan.c | ||||
|   emu.c | ||||
|   emu_nosv.c | ||||
|   emu_openmp.c | ||||
|   emu_ovni.c | ||||
|   emu_tampi.c | ||||
|   emu_nodes.c | ||||
|   emu_kernel.c | ||||
|   emu_nanos6.c | ||||
|   emu_task.c | ||||
|   trace.c | ||||
|   ovni.c | ||||
|   parson.c | ||||
|   pcf.c | ||||
|   prv.c | ||||
| ) | ||||
| 
 | ||||
| add_executable(ovnidump | ||||
|   dump.c | ||||
|   ovni.c | ||||
|   trace.c | ||||
|   parson.c | ||||
| ) | ||||
| 
 | ||||
| add_executable(ovnisort | ||||
|   sort.c | ||||
|   ovni.c | ||||
|   trace.c | ||||
|   parson.c | ||||
| ) | ||||
| 
 | ||||
| # Use <PackageName>_ROOT variables if available, commonly used by MPI | ||||
| # installations | ||||
| if(POLICY CMP0074) | ||||
|   cmake_policy(SET CMP0074 NEW) | ||||
| endif() | ||||
| 
 | ||||
| find_package(MPI REQUIRED) | ||||
| 
 | ||||
| if(NOT MPI_USE_RUNPATH) | ||||
|   # Ensure we use RPATH (not RUNPATH) to link with MPI library, so we are | ||||
|   # protected against LD_LIBRARY_PATH overrides. | ||||
|   target_link_options(MPI::MPI_C INTERFACE "LINKER:--disable-new-dtags") | ||||
| endif() | ||||
| 
 | ||||
| add_executable(ovnisync ovnisync.c) | ||||
| target_link_libraries(ovnisync m MPI::MPI_C) | ||||
| 
 | ||||
| install(TARGETS ovni LIBRARY DESTINATION lib) | ||||
| install(TARGETS ovniemu ovnidump ovnisync ovnisort RUNTIME DESTINATION bin) | ||||
| install(FILES ovni.h DESTINATION include) | ||||
| add_subdirectory(rt) | ||||
| add_subdirectory(emu) | ||||
|  | ||||
							
								
								
									
										47
									
								
								src/emu/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/emu/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,47 @@ | ||||
| # Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC) | ||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||
| 
 | ||||
| add_library(trace STATIC trace.c) | ||||
| target_link_libraries(trace parson ovni-static) | ||||
| 
 | ||||
| add_library(emu STATIC | ||||
|   chan.c | ||||
|   emu.c | ||||
|   nosv.c | ||||
|   openmp.c | ||||
|   ovni.c | ||||
|   tampi.c | ||||
|   nodes.c | ||||
|   kernel.c | ||||
|   nanos6.c | ||||
|   task.c | ||||
|   pcf.c | ||||
|   prv.c | ||||
| ) | ||||
| 
 | ||||
| include_directories( | ||||
|   "${CMAKE_SOURCE_DIR}/src/include" | ||||
|   "${CMAKE_SOURCE_DIR}/src" | ||||
|   "${CMAKE_SOURCE_DIR}/include" | ||||
| ) | ||||
| 
 | ||||
| add_executable(ovniemu ovniemu.c) | ||||
| target_link_libraries(ovniemu emu trace) | ||||
| 
 | ||||
| add_executable(ovnidump ovnidump.c) | ||||
| target_link_libraries(ovnidump emu trace) | ||||
| 
 | ||||
| add_executable(ovnisort ovnisort.c) | ||||
| target_link_libraries(ovnisort emu trace) | ||||
| 
 | ||||
| # Use <PackageName>_ROOT variables if available, commonly used by MPI | ||||
| # installations | ||||
| if(POLICY CMP0074) | ||||
|   cmake_policy(SET CMP0074 NEW) | ||||
| endif() | ||||
| 
 | ||||
| find_package(MPI REQUIRED) | ||||
| add_executable(ovnisync ovnisync.c) | ||||
| target_link_libraries(ovnisync m MPI::MPI_C) | ||||
| 
 | ||||
| install(TARGETS ovniemu ovnidump ovnisync ovnisort RUNTIME DESTINATION bin) | ||||
| @ -448,8 +448,8 @@ emu_load_first_events(struct ovni_emu *emu) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| emulate(struct ovni_emu *emu) | ||||
| void | ||||
| emu_run(struct ovni_emu *emu) | ||||
| { | ||||
| 	emu->nev_processed = 0; | ||||
| 	emu_load_first_events(emu); | ||||
| @ -1001,7 +1001,7 @@ create_pcf_cpus(struct ovni_emu *emu) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| void | ||||
| emu_init(struct ovni_emu *emu, int argc, char *argv[]) | ||||
| { | ||||
| 	memset(emu, 0, sizeof(*emu)); | ||||
| @ -1184,7 +1184,7 @@ copy_configs(struct ovni_emu *emu) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| void | ||||
| emu_post(struct ovni_emu *emu) | ||||
| { | ||||
| 	/* Write the PCF files */ | ||||
| @ -1197,7 +1197,7 @@ emu_post(struct ovni_emu *emu) | ||||
| 	copy_configs(emu); | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| void | ||||
| emu_destroy(struct ovni_emu *emu) | ||||
| { | ||||
| 	fix_prv_headers(emu); | ||||
| @ -1248,24 +1248,3 @@ eerr(struct ovni_emu *emu, const char *fmt, ...) | ||||
| 			emu->cur_ev->header.clock, | ||||
| 			emu->cur_thread->tid); | ||||
| } | ||||
| 
 | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
| 	struct ovni_emu *emu = malloc(sizeof(struct ovni_emu)); | ||||
| 
 | ||||
| 	if (emu == NULL) { | ||||
| 		perror("malloc"); | ||||
| 		return 1; | ||||
| 	} | ||||
| 
 | ||||
| 	emu_init(emu, argc, argv); | ||||
| 	err("emulation starts\n"); | ||||
| 	emulate(emu); | ||||
| 	emu_post(emu); | ||||
| 	emu_destroy(emu); | ||||
| 	err("emulation ends\n"); | ||||
| 	free(emu); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| @ -578,4 +578,9 @@ struct ovni_ethread *emu_get_thread(struct ovni_eproc *proc, int tid); | ||||
| 
 | ||||
| void emu_cpu_update_chan(struct ovni_cpu *cpu, struct ovni_chan *cpu_chan); | ||||
| 
 | ||||
| void emu_init(struct ovni_emu *emu, int argc, char *argv[]); | ||||
| void emu_run(struct ovni_emu *emu); | ||||
| void emu_post(struct ovni_emu *emu); | ||||
| void emu_destroy(struct ovni_emu *emu); | ||||
| 
 | ||||
| #endif /* OVNI_EMU_H */ | ||||
| @ -6,7 +6,7 @@ | ||||
| 
 | ||||
| #include "chan.h" | ||||
| #include "emu.h" | ||||
| #include "emu_task.h" | ||||
| #include "task.h" | ||||
| #include "ovni.h" | ||||
| #include "prv.h" | ||||
| 
 | ||||
| @ -6,7 +6,7 @@ | ||||
| 
 | ||||
| #include "chan.h" | ||||
| #include "emu.h" | ||||
| #include "emu_task.h" | ||||
| #include "task.h" | ||||
| #include "ovni.h" | ||||
| #include "prv.h" | ||||
| 
 | ||||
							
								
								
									
										24
									
								
								src/emu/ovniemu.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/emu/ovniemu.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| #include "emu.h" | ||||
| 
 | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| int | ||||
| main(int argc, char *argv[]) | ||||
| { | ||||
| 	struct ovni_emu *emu = malloc(sizeof(struct ovni_emu)); | ||||
| 
 | ||||
| 	if (emu == NULL) { | ||||
| 		perror("malloc"); | ||||
| 		return 1; | ||||
| 	} | ||||
| 
 | ||||
| 	emu_init(emu, argc, argv); | ||||
| 	err("emulation starts\n"); | ||||
| 	emu_run(emu); | ||||
| 	emu_post(emu); | ||||
| 	emu_destroy(emu); | ||||
| 	err("emulation ends\n"); | ||||
| 	free(emu); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| @ -6,7 +6,7 @@ | ||||
| 
 | ||||
| #include "chan.h" | ||||
| #include "emu.h" | ||||
| #include "emu_task.h" | ||||
| #include "task.h" | ||||
| #include "ovni.h" | ||||
| #include "prv.h" | ||||
| 
 | ||||
							
								
								
									
										4
									
								
								src/include/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/include/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| # Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC) | ||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||
| 
 | ||||
| include_directories("${CMAKE_CURRENT_SOURCE_DIR}") | ||||
| @ -19,4 +19,4 @@ gettid(void) | ||||
| #endif /* !__GLIBC_PREREQ(2, 30) */ | ||||
| #endif /* defined(__GLIBC__) */ | ||||
| 
 | ||||
| #endif// COMPAT_H
 | ||||
| #endif /* COMPAT_H */ | ||||
							
								
								
									
										17
									
								
								src/rt/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/rt/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| # Copyright (c) 2021-2022 Barcelona Supercomputing Center (BSC) | ||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||
| 
 | ||||
| include_directories("${CMAKE_SOURCE_DIR}/src/include") | ||||
| 
 | ||||
| add_library(ovni SHARED ovni.c) | ||||
| target_link_libraries(ovni parson) | ||||
| target_include_directories(ovni PUBLIC "${CMAKE_SOURCE_DIR}/include") | ||||
| set_target_properties(ovni PROPERTIES | ||||
|   VERSION 1.0.0 | ||||
|   SOVERSION 1) | ||||
| 
 | ||||
| add_library(ovni-static STATIC ovni.c) | ||||
| target_link_libraries(ovni-static parson) | ||||
| target_include_directories(ovni-static PUBLIC "${CMAKE_SOURCE_DIR}/include") | ||||
| 
 | ||||
| install(TARGETS ovni LIBRARY DESTINATION lib) | ||||
| @ -41,7 +41,7 @@ function(ovni_test source) | ||||
|     "OVNI_NPROCS=${OVNI_TEST_NPROC}") | ||||
| 
 | ||||
|   list(APPEND OVNI_TEST_ENV | ||||
|     "OVNI_BUILD_DIR=${CMAKE_BINARY_DIR}/src") | ||||
|     "OVNI_BUILD_DIR=${CMAKE_BINARY_DIR}/src/emu") | ||||
| 
 | ||||
|   list(APPEND OVNI_TEST_ENV | ||||
|     "OVNI_CURRENT_DIR=${CMAKE_CURRENT_BINARY_DIR}") | ||||
| @ -53,6 +53,11 @@ function(ovni_test source) | ||||
|     list(APPEND OVNI_TEST_ENV "OVNI_DO_SORT=1") | ||||
|   endif() | ||||
| 
 | ||||
|   include_directories( | ||||
|     "${CMAKE_SOURCE_DIR}/src/include" | ||||
|     "${CMAKE_SOURCE_DIR}/src" | ||||
|     "${CMAKE_SOURCE_DIR}/include" | ||||
|   ) | ||||
|   add_executable("${OVNI_TEST_NAME}" "${OVNI_TEST_SOURCE}") | ||||
|   target_link_libraries("${OVNI_TEST_NAME}" PRIVATE ovni) | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user