-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from lanl/gcc
CMake Options (-REQUIRED_AVX, REQUIRED_EXAMPLES, REQUIRED_TESTS)
- Loading branch information
Showing
36 changed files
with
426 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "external/argtable3"] | ||
path = external/argtable3 | ||
[submodule "clients/spatter/external/argtable3"] | ||
path = clients/spatter/external/argtable3 | ||
url = https://github.com/argtable/argtable3.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,57 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(memory-accelerator C) | ||
cmake_minimum_required(VERSION 3.12) | ||
project(scoria C) | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
add_subdirectory(src) | ||
|
||
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-function -Wno-strict-prototypes -g) | ||
|
||
# JL: Can't use STREQUAL here because the compiler ID could be "IntelLLVM" | ||
if (CMAKE_C_COMPILER_ID MATCHES "Intel") | ||
add_compile_options(-mavx512f -Wno-debug-disables-optimization) | ||
else() | ||
add_compile_options(-g) | ||
endif() | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
|
||
include_directories(include) | ||
include_directories(include/controller) | ||
include_directories(include/client) | ||
include_directories(include/posix) | ||
include_directories(include/shared) | ||
include_directories(include/uthash) | ||
|
||
add_executable(client client.c ${CLIENT_SOURCE_FILES} ${SHARED_SOURCE_FILES}) | ||
target_link_libraries(client shm pthread rt) | ||
|
||
add_executable(controller controller.c ${CONTROLLER_SOURCE_FILES} ${SHARED_SOURCE_FILES}) | ||
target_link_libraries(controller shm pthread rt) | ||
|
||
|
||
find_package(Git QUIET) | ||
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") | ||
# Update submodules as needed | ||
option(GIT_SUBMODULE "Check submodules during build" ON) | ||
if(GIT_SUBMODULE) | ||
message(STATUS "Submodule update") | ||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
RESULT_VARIABLE GIT_SUBMOD_RESULT) | ||
if(NOT GIT_SUBMOD_RESULT EQUAL "0") | ||
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") | ||
endif() | ||
endif() | ||
# set supported intrinsics | ||
set(SCORIA_SUPPORTED_INTRINSICS AVX SVE) | ||
|
||
foreach(_intrinsic ${SCORIA_SUPPORTED_INTRINSICS}) | ||
option(Scoria_REQUIRE_${_intrinsic} "Build Scoria with ${intrinsic} support" OFF) | ||
endforeach() | ||
|
||
if(Scoria_REQUIRE_AVX) | ||
message(STATUS "Building with AVX support") | ||
add_compile_options(-mavx512f) | ||
add_compile_definitions(USE_AVX) | ||
else() | ||
message(STATUS "Building without AVX suppoort") | ||
endif() | ||
|
||
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/argtable3/CMakeLists.txt") | ||
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") | ||
if(Scoria_REQUIRE_SVE) | ||
message(FATAL_ERROR "Scoria does not have SVE support at this time") | ||
else() | ||
message(STATUS "Building without SVE support") | ||
endif() | ||
|
||
if (CMAKE_C_COMPILER_ID MATCHES "Intel") | ||
add_compile_options(-Rno-debug-disables-optimization) | ||
endif() | ||
|
||
add_subdirectory(external/argtable3) | ||
include_directories(external/argtable3/src) | ||
|
||
add_subdirectory(tests) | ||
option(Scoria_REQUIRE_CLIENTS "Build Scoria example clients" ON) | ||
if(Scoria_REQUIRE_CLIENTS) | ||
message(STATUS "Building Example Clients") | ||
add_subdirectory(clients) | ||
endif() | ||
|
||
option(Scoria_REQUIRE_TESTS "Build Scoria with test client" OFF) | ||
if(Scoria_REQUIRE_TESTS) | ||
message(STATUS "Building with Test Client") | ||
add_subdirectory(tests) | ||
endif() | ||
add_executable(scoria controller.c ${CONTROLLER_SOURCE_FILES} ${SHARED_SOURCE_FILES}) | ||
|
||
target_link_libraries(scoria shm pthread rt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_subdirectory(simple) | ||
add_subdirectory(spatter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(scoria C) | ||
|
||
add_executable(simple_client simple_client.c ${CLIENT_SOURCE_FILES} ${SHARED_SOURCE_FILES}) | ||
target_link_libraries(simple_client shm pthread rt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include <stdio.h> | ||
|
||
#include "client.h" | ||
#include "config.h" | ||
|
||
#include "client_cleanup.h" | ||
#include "client_init.h" | ||
#include "client_memory.h" | ||
#include "client_wait_requests.h" | ||
|
||
#include "shm_malloc.h" | ||
|
||
void place_requests(struct client *client) { | ||
// Allocate Buffer | ||
double *A = shm_malloc(1024 * sizeof(int)); | ||
|
||
if (client->chatty) | ||
printf("Client(%d): Received Pointer to Allocated Memory: %p\n", client->id, | ||
(void *)A); | ||
|
||
// Write to Buffer | ||
printf("Client(%d): Writing Array:\n", client->id); | ||
|
||
double *input = shm_malloc(1024 * sizeof(double)); | ||
for (size_t i = 0; i < 1024; ++i) { | ||
input[i] = (double)(2 * i); | ||
} | ||
|
||
struct request req1; | ||
scoria_write(client, A, 1024, input, NULL, NULL, 0, 0, &req1); | ||
wait_request(client, &req1); | ||
shm_free(input); | ||
|
||
// Read from Buffer | ||
printf("Client(%d): Reading Array:\n", client->id); | ||
|
||
double *output = shm_malloc(1024 * sizeof(double)); | ||
|
||
struct request req2; | ||
scoria_read(client, A, 1024, output, NULL, NULL, 0, 0, &req2); | ||
wait_request(client, &req2); | ||
|
||
for (size_t i = 0; i < 1024; ++i) | ||
printf("%.2f ", output[i]); | ||
printf("\n"); | ||
shm_free(output); | ||
|
||
// Free Buffer | ||
shm_free(A); | ||
|
||
// Exit Program | ||
// struct request req3; | ||
// scoria_quit(client, &req3); | ||
|
||
// wait_request(client, &req3); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
// Suppress Compiler Warnings | ||
(void)argc; | ||
(void)argv; | ||
|
||
struct client client; | ||
client.chatty = 0; | ||
|
||
init(&client); | ||
place_requests(&client); | ||
|
||
cleanup(&client); | ||
|
||
printf("Exiting...\n"); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
find_package(Git QUIET) | ||
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") | ||
# Update submodules as needed | ||
option(GIT_SUBMODULE "Check submodules during build" ON) | ||
if(GIT_SUBMODULE) | ||
message(STATUS "Submodule update") | ||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
RESULT_VARIABLE GIT_SUBMOD_RESULT) | ||
if(NOT GIT_SUBMOD_RESULT EQUAL "0") | ||
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") | ||
endif() | ||
endif() | ||
endif() | ||
|
||
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/clients/spatter/external/argtable3/CMakeLists.txt") | ||
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") | ||
endif() | ||
|
||
add_subdirectory(external/argtable3) | ||
include_directories(external/argtable3/src) | ||
|
||
add_executable(spatter_client spatter_client.c parse-args.c json.c sp_alloc.c pcg_basic.c backend-support-tests.c ${CLIENT_SOURCE_FILES} ${SHARED_SOURCE_FILES}) | ||
target_compile_definitions(spatter_client PUBLIC USE_SERIAL) | ||
target_link_libraries(spatter_client shm pthread rt m argtable3) | ||
|
File renamed without changes.
File renamed without changes.
Submodule argtable3
updated
from 000000 to f46ef2
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
include/client/client_place_requests.h → include/client/client_wait_requests.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
#ifndef CLIENT_PLACE_REQUESTS | ||
#define CLIENT_PLACE_REQUESTS | ||
#ifndef CLIENT_WAIT_REQUESTS | ||
#define CLIENT_WAIT_REQUESTS | ||
|
||
#include "client.h" | ||
#include "request.h" | ||
|
||
void wait_request(struct client *client, struct request *req); | ||
void wait_requests(struct client *client, struct request *reqs, | ||
size_t num_reqs); | ||
void place_requests(struct client *client); | ||
|
||
#endif /* CLIENT_PLACE_REQUESTS */ | ||
#endif /* CLIENT_WAIT_REQUESTS */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.