-
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 #1 from JDTruj2018/first-commit
First commit - migration from gitlab
- Loading branch information
Showing
64 changed files
with
9,762 additions
and
0 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
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,3 @@ | ||
[submodule "external/argtable3"] | ||
path = 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(memory-accelerator C) | ||
|
||
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() | ||
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.") | ||
endif() | ||
|
||
add_subdirectory(external/argtable3) | ||
include_directories(external/argtable3/src) | ||
|
||
add_subdirectory(tests) |
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,71 @@ | ||
# ScorIA | ||
|
||
## Description | ||
Prototype testbed for various memory acceleration schemes focused on improving sparse memory accesses and scatter/gather performance through indirection arrays. | ||
|
||
## Installation | ||
``` | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make | ||
``` | ||
|
||
## Usage | ||
Terminal window 1 | ||
``` | ||
./controller | ||
``` | ||
|
||
Terminal window 2 | ||
``` | ||
./tests/test_client | ||
``` | ||
|
||
## Roadmap | ||
Current Work: | ||
- [x] Request Ring Buffer | ||
- [x] Controller Request Handler | ||
- [x] Develop Initial Test Cases | ||
- [x] Implement Read, Write | ||
- [x] Asynchronous Requests | ||
- [x] Atomic, Serialized, and Parallel Writes (Aliasing) | ||
- [x] Multi-threading | ||
- [x] Multi-client | ||
- [x] Integration with Spatter | ||
|
||
Future: | ||
- [ ] AVX intrinsics | ||
- [ ] SVE intrinsics | ||
- [ ] Read/Write Dependency Graphs | ||
- [ ] Run and Test scripts | ||
|
||
Initial Requirements: | ||
- [x] Multi-Process (Separation between client and server) | ||
- [x] Server is the memory controller | ||
- [x] Memory controller needs to be multi-threaded | ||
- [x] Needs to be able to use vector load store (for optimized bandwidth) | ||
- [x] Needs an API for taking memory access requests | ||
- [x] Needs to run on CPU hardware | ||
- [ ] Needs to be numa aware | ||
- [ ] Start prototyping on SPR (DDR) | ||
- [x] Define some test program for driving this | ||
- [x] allocaate A[], B[], C[] | ||
- [x] fetch (A[B[C[i]]] for i = 0:1000 | ||
- [x] D[1000] | ||
- [x] Determine what we will use for programming language (C) | ||
- [x] FPGA friendly | ||
- [ ] Modular SGDMA | ||
- [x] Determine the shared memory programming paradigm | ||
- [x] Specialized memory allocator | ||
- [x] Everything in shared memory | ||
- [x] A, B, and C need to be allocated in shared memory (shared between the two process spaces) | ||
- [x] These should probably be allocated at the same virtual address locations | ||
- [ ] Synchronous vs. Asynchronous | ||
- [x] MPI_IReceive and MPI_Wait as inspiration | ||
- [x] Handles of some sort | ||
- [x] Could also just be an update of the latest fetched index (in a prefetching workload) in a well-known mailbox | ||
|
||
## Authors and acknowledgment | ||
- Jered Dominguez-Trujillo jereddt@lanl.gov | ||
- Jonas Lippuner jlippuner@lanl.gov |
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 @@ | ||
#include <stdio.h> | ||
|
||
#include "client.h" | ||
#include "config.h" | ||
|
||
#include "client_cleanup.h" | ||
#include "client_init.h" | ||
#include "client_place_requests.h" | ||
|
||
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 @@ | ||
#include <stdio.h> | ||
|
||
#include "config.h" | ||
#include "controller.h" | ||
|
||
#include "controller_cleanup.h" | ||
#include "controller_handle_requests.h" | ||
#include "controller_init.h" | ||
|
||
int main(int argc, char **argv) { | ||
// Suppress Compiler Warnings | ||
(void)argc; | ||
(void)argv; | ||
|
||
struct controller controller; | ||
controller.chatty = 1; | ||
|
||
init(&controller); | ||
handle_requests(&controller); | ||
|
||
cleanup(&controller); | ||
|
||
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,30 @@ | ||
#ifndef CLIENT_H | ||
#define CLIENT_H | ||
|
||
#include <semaphore.h> | ||
|
||
#include "config.h" | ||
#include "request.h" | ||
|
||
struct client { | ||
int id; | ||
|
||
int fd_location; | ||
int fd_requests; | ||
int fd_completions; | ||
|
||
int chatty; | ||
|
||
struct memory_location *shared_location; | ||
|
||
struct request_queue_list *shared_requests_list; | ||
struct request_queue_list *shared_completions_list; | ||
struct shared_memory *shared_mem_ptr; | ||
|
||
struct request_queue *shared_requests; | ||
struct request_queue *shared_completions; | ||
|
||
struct request *unmatched_requests; | ||
}; | ||
|
||
#endif /* CLIENT_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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef CLIENT_CLEANUP | ||
#define CLIENT_CLEANUP | ||
|
||
#include "client.h" | ||
|
||
void cleanup_queues(struct client *client); | ||
void cleanup_shared_mem(struct client *client); | ||
void cleanup(struct client *client); | ||
|
||
#endif /* CLIENT_CLEANUP */ |
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,13 @@ | ||
#ifndef CLIENT_INIT | ||
#define CLIENT_INIT | ||
|
||
#include "client.h" | ||
#include "request.h" | ||
|
||
void init_memory_pool(struct client *client); | ||
void init_requests(struct client *client); | ||
void init_completions(struct client *client); | ||
void init_id(struct client *client); | ||
void init(struct client *client); | ||
|
||
#endif /* CLIENT_INIT */ |
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,19 @@ | ||
#ifndef CLIENT_MEMORY_H | ||
#define CLIENT_MEMORY_H | ||
|
||
#include <semaphore.h> | ||
|
||
#include "client.h" | ||
#include "request.h" | ||
|
||
void scoria_put_request(struct client *client, struct request *req); | ||
|
||
void scoria_quit(struct client *client, struct request *req); | ||
void scoria_read(struct client *client, void *buffer, const size_t N, | ||
void *output, const size_t *ind1, const size_t *ind2, | ||
size_t num_threads, bool use_avx, struct request *req); | ||
void scoria_write(struct client *client, void *buffer, const size_t N, | ||
void *input, const size_t *ind1, const size_t *ind2, | ||
size_t num_threads, bool use_avx, struct request *req); | ||
|
||
#endif /* CLIENT_MEMORY_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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef CLIENT_PLACE_REQUESTS | ||
#define CLIENT_PLACE_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 */ |
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,8 @@ | ||
#ifndef CLIENT_READ_LOCATION | ||
#define CLIENT_READ_LOCATION | ||
|
||
#include "client.h" | ||
|
||
void read_location(struct client *client); | ||
|
||
#endif /* CLIENT_READ_LOCATION */ |
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,30 @@ | ||
#ifndef CONFIG_H | ||
#define CONFIG_H | ||
|
||
#define SHARED_MEMORY_NAME "shared-mem" | ||
#define SHARED_LOCATION_NAME "/mem-controller-location" | ||
#define SHARED_REQUESTS_NAME "/mem-request-queue" | ||
#define SHARED_COMPLETIONS_NAME "/mem-completion-queue" | ||
|
||
#define REQUEST_QUEUE_SIZE 100 | ||
#define MAX_CLIENTS 64 | ||
|
||
struct list { | ||
struct list *next; | ||
int data; | ||
}; | ||
|
||
struct shared_memory { | ||
struct list *head; | ||
struct list **tail; | ||
}; | ||
|
||
struct memory_location { | ||
int ready; | ||
|
||
struct shared_memory *shared_mem_ptr; | ||
struct request_queue_list *shared_requests_list; | ||
struct request_queue_list *shared_completions_list; | ||
}; | ||
|
||
#endif /* CONFIG_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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef CONTROLLER_H | ||
#define CONTROLLER_H | ||
|
||
#include <semaphore.h> | ||
|
||
#include "config.h" | ||
#include "request.h" | ||
|
||
struct controller { | ||
int fd_location; | ||
int fd_requests; | ||
int fd_completions; | ||
|
||
int chatty; | ||
|
||
struct memory_location *shared_location; | ||
|
||
struct request_queue_list *shared_requests_list; | ||
struct request_queue_list *shared_completions_list; | ||
struct shared_memory *shared_mem_ptr; | ||
}; | ||
|
||
#endif /* CONTROLLER_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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef CONTROLLER_CLEANUP | ||
#define CONTROLLER_CLEANUP | ||
|
||
#include "controller.h" | ||
|
||
void cleanup_shared_mem(struct controller *controller); | ||
void cleanup(struct controller *controller); | ||
|
||
#endif /* CONTROLLER_CLEANUP */ |
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,20 @@ | ||
#ifndef CONTROLLER_HANDLE_REQUESTS | ||
#define CONTROLLER_HANDLE_REQUESTS | ||
|
||
#include "controller.h" | ||
#include "request.h" | ||
|
||
struct thread_args { | ||
size_t i; | ||
struct controller *controller; | ||
}; | ||
|
||
void handle_read(struct controller *controller, struct request_queue *queue, | ||
struct request *req); | ||
void handle_write(struct controller *controller, struct request_queue *queue, | ||
struct request *req); | ||
|
||
void *handler(void *args); | ||
void handle_requests(struct controller *controller); | ||
|
||
#endif /* CONTROLLER_HANDLE_REQUESTS */ |
Oops, something went wrong.