First commit (Basic bsp setup)
This commit is contained in:
commit
61402f7b00
4 changed files with 72 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
build*
|
||||
*user
|
||||
|
20
CMakeLists.txt
Normal file
20
CMakeLists.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
include_directories(SYSTEM "${PROJECT_SOURCE_DIR}/include/")
|
||||
|
||||
option(MultiCoreBSP "Building with Multi Core BSP" OFF)
|
||||
if(MultiCoreBSP)
|
||||
# setup for my mac
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(libs mcbsp1.1.0 m pthread)
|
||||
add_definitions( -DUSE_MCBSP )
|
||||
else()
|
||||
# setup for cartesius
|
||||
set(libs bsponmpi m)
|
||||
endif()
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS program_options)
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
set(libs ${libs} ${Boost_LIBRARIES})
|
||||
|
||||
add_subdirectory("wavelet")
|
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
jcmp
|
||||
====
|
||||
|
||||
My very own image compression format. Made during a course on parallel
|
||||
computing. There will be a sequential and parallel version. The git repo is
|
||||
extracted from the homework repo, and may contain some unrelated things.
|
||||
|
42
include/bsp.hpp
Normal file
42
include/bsp.hpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
extern "C" {
|
||||
#ifdef USE_MCBSP
|
||||
#include <mcbsp.h>
|
||||
#else
|
||||
#include "bsp.h"
|
||||
#define MCBSP_PROCESSOR_INDEX_DATATYPE int
|
||||
#define MCBSP_BYTESIZE_TYPE int
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace bsp {
|
||||
typedef MCBSP_PROCESSOR_INDEX_DATATYPE processor_index;
|
||||
typedef MCBSP_BYTESIZE_TYPE size_type;
|
||||
|
||||
inline void begin(processor_index P) { bsp_begin(P); }
|
||||
inline void end() { bsp_end(); }
|
||||
inline void init(void (*spmd)(), int argc, char ** argv){ bsp_init(spmd, argc, argv); }
|
||||
inline processor_index nprocs() { return bsp_nprocs(); }
|
||||
inline processor_index pid() { return bsp_pid(); }
|
||||
inline double time() { return bsp_time(); }
|
||||
inline void sync() { bsp_sync(); }
|
||||
|
||||
// As we know the type, we don't bother the programmer with bytes and sizeof. Instead simply use the number of elements.
|
||||
template <typename T>
|
||||
void push_reg(T* value, size_type number = 1)
|
||||
{ bsp_push_reg(static_cast<void*>(value), number * sizeof(T)); }
|
||||
|
||||
template <typename T>
|
||||
void pop_reg(T* value)
|
||||
{ bsp_pop_reg(static_cast<void*>(value)); }
|
||||
|
||||
// The offset too is in terms of number of elements, not bytes.
|
||||
template <typename T>
|
||||
void put(processor_index p, T const * source, T * destination, size_type offset = 0, size_type number = 1)
|
||||
{ bsp_put(p, static_cast<void const *>(source), static_cast<void*>(destination), offset * sizeof(T), number * sizeof(T)); }
|
||||
|
||||
template <typename T>
|
||||
void get(processor_index p, T const * source, size_type offset, T * destination, size_type number = 1)
|
||||
{ bsp_get(p, static_cast<void const *>(source), offset, static_cast<void*>(destination), number * sizeof(T)); }
|
||||
}
|
Reference in a new issue