Skip to content

Commit

Permalink
Improving multi-backend support
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-smcmillan committed Jun 13, 2018
1 parent c90f4ad commit eca051f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 9 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ source" style build to make it easy to clean up. We build in to a

$ mkdir build
$ cd build
$ cmake ../src
$ cmake [-DPLATFORM=<backend>] ../src
$ make

The PLATFORM argument to cmake specifies which backend source code should
configured for the build and the value must correspond to a subdirectory
in "gbtl/src/graphblas/system/" and that subdirectory must have a
"backend_include.hpp" file. If this argument is omitted it defaults to
configuring the "sequential" backend.

Using "make -i -j8" tries to build every test (ignoring all erros) and
uses all eight the CPU's cores to speed up the build (use a number
appropriate for your system).
Expand Down
31 changes: 23 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,31 @@

cmake_minimum_required(VERSION 2.8)

project(SPIRALGRAPH)

# https://stackoverflow.com/questions/14306642/adding-multiple-executables-in-cmake
project(GRAPHBLAS_TEMPLATE_LIBRARY_2)

# For debugging
#message("CMake SRC: ${CMAKE_SOURCE_DIR}")
#message("Project Name: ${PROJECT_NAME}")
#message("Bin Directory: ${CMAKE_BINARY_DIR}")
#message("Project Name: ${CMAKE_SOURCE_DIR}")
#message("PProject Bin Directory: ${PROJECT_BINARY_DIR}")
message("CMake SRC: ${CMAKE_SOURCE_DIR}")
message("Project Name: ${PROJECT_NAME}")
message("Bin Directory: ${CMAKE_BINARY_DIR}")
message("Project Name: ${CMAKE_SOURCE_DIR}")
message("Project Bin Directory: ${PROJECT_BINARY_DIR}")

# Default platform is sequential
if (NOT PLATFORM)
set(PLATFORM sequential)
endif()

message("Configuring platform: ${PLATFORM}")

if (EXISTS ${CMAKE_SOURCE_DIR}/graphblas/system/${PLATFORM})
file(COPY ${CMAKE_SOURCE_DIR}/graphblas/system/${PLATFORM}/backend_include.hpp DESTINATION ${CMAKE_SOURCE_DIR}/graphblas)
else()
message(FATAL_ERROR "Backend directory does not exist: ${PLATFORM}")
endif()

unset($PLATFORM)

# https://stackoverflow.com/questions/14306642/adding-multiple-executables-in-cmake

# This seems hokey that we need to include the root as our directory
include_directories(${CMAKE_SOURCE_DIR})
Expand Down
18 changes: 18 additions & 0 deletions src/graphblas/system/README_backend.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Each subdirectory in this (system) directory, contains the backend code for
one platform. The name of the subdirectory is the name of the platform used
when configuring the build. Note that only one backend can be configured and
compiled at a time.

Each backend should copy backend_include_temp.hpp into the backend directory,
rename it "backend_include.hpp", and modify the contents to point to a set of
header files within the backend directory:
<backend name>.hpp - that includes all of the other backend header files
Matrix.hpp
Vector.hpp
utility.hpp
TransposeView.hpp
ComplementView.hpp
operations.hpp

This backend_include.hpp file is copied to the frontend during cmake build
configuration.
File renamed without changes.
File renamed without changes.

0 comments on commit eca051f

Please sign in to comment.