Commit 3cf33fdb authored by Armin Sobhani's avatar Armin Sobhani
Browse files

remove boost.compute samples by default

parent 092aae60
......@@ -11,9 +11,12 @@ cmake_minimum_required(VERSION 2.8)
project(BoostBioseq)
# find OpenCL
find_package(OpenCL REQUIRED)
include_directories(SYSTEM ${OpenCL_INCLUDE_DIRS})
option(BOOST_BIOSEQ_BUILD_OPENCL_SAMPLES "Build the Boost.Bioseq OpenCL samples" OFF)
if(${BOOST_BIOSEQ_BUILD_OPENCL_SAMPLES})
# find OpenCL
find_package(OpenCL REQUIRED)
include_directories(SYSTEM ${OpenCL_INCLUDE_DIRS})
endif()
# find Boost
find_package(Boost 1.53 REQUIRED)
......
......@@ -12,7 +12,6 @@
#include <boost/range/sub_range.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/compute/system.hpp>
#ifndef BOOST_BIOSEQ_HAS_COMPONENT_HPP
#include <boost/bioseq/has_component.hpp>
......@@ -42,10 +41,6 @@ public:
: ContainerT<CharT, AllocatorT<CharT>>()
{}
explicit sequence_host(size_t count, const boost::compute::context& cntxt)
: ContainerT<CharT, AllocatorT<CharT>>(count, cntxt)
{}
explicit sequence_host(
const AllocatorT<CharT>& alloc)
: ContainerT<CharT, AllocatorT<CharT>>(alloc)
......
......@@ -27,13 +27,15 @@ foreach(BENCHMARK ${BENCHMARKS})
target_link_libraries(${PERF_TARGET} ${Boost_LIBRARIES})
endforeach()
set(BOOST_COMPUTE_BENCHMARKS
bc_random_sequence
bc_reverse_complement
)
if(${BOOST_BIOSEQ_BUILD_OPENCL_SAMPLES})
set(BOOST_COMPUTE_BENCHMARKS
bc_random_sequence
bc_reverse_complement
)
foreach(BENCHMARK ${BOOST_COMPUTE_BENCHMARKS})
set(PERF_TARGET perf_${BENCHMARK})
add_executable(${PERF_TARGET} perf_${BENCHMARK}.cpp)
target_link_libraries(${PERF_TARGET} ${OpenCL_LIBRARIES} ${Boost_LIBRARIES})
endforeach()
foreach(BENCHMARK ${BOOST_COMPUTE_BENCHMARKS})
set(PERF_TARGET perf_${BENCHMARK})
add_executable(${PERF_TARGET} perf_${BENCHMARK}.cpp)
target_link_libraries(${PERF_TARGET} ${OpenCL_LIBRARIES} ${Boost_LIBRARIES})
endforeach()
endif()
\ No newline at end of file
......@@ -40,7 +40,6 @@ function(add_bioseq_test TEST_NAME TEST_SOURCE)
get_filename_component(TEST_TARGET ${TEST_SOURCE} NAME_WE)
add_executable(${TEST_TARGET} ${TEST_SOURCE})
target_link_libraries(${TEST_TARGET}
${OpenCL_LIBRARIES}
${Boost_LIBRARIES}
)
......@@ -48,7 +47,6 @@ function(add_bioseq_test TEST_NAME TEST_SOURCE)
endfunction()
add_bioseq_test("sequence" test_sequence.cpp)
add_bioseq_test("boost.compute.sequence" test_bc_sequence.cpp)
add_bioseq_test("name.component" test_name_component.cpp)
add_bioseq_test("description.component" test_description_component.cpp)
add_bioseq_test("io.fasta" test_io_fasta.cpp)
......
//----------------------------------------------------------------------------//
// Copyright (c) 2018 Armin Sobhani <arminms@gmail.com>
//
// Distributed under the Boost Software License Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//----------------------------------------------------------------------------//
#define BOOST_TEST_MODULE TestBoostComputeSequence
#include <boost/mpl/list.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/container/basic_string.hpp>
#include <boost/bioseq/type_traits.hpp>
#include <boost/bioseq/sequence.hpp>
namespace bsq = boost::bioseq;
namespace bc = boost::compute;
typedef bsq::sequence_host<char, bc::buffer_allocator, bc::vector> seq;
struct Context
{
boost::compute::device device;
boost::compute::context context;
boost::compute::command_queue queue;
Context() :
device ( boost::compute::system::default_device() ),
context( boost::compute::system::default_context() ),
queue ( boost::compute::system::default_queue() )
{}
};
BOOST_FIXTURE_TEST_SUITE(compute_test, Context)
BOOST_AUTO_TEST_CASE(constructor_char_pointer_n)
{
std::cout << "device: " << device.name() << std::endl;
seq s("ATCGN", 4);
auto b = s.cbegin();
BOOST_CHECK_EQUAL( *b , 'A');
BOOST_CHECK_EQUAL(*(++b), 'T');
BOOST_CHECK_EQUAL(*(++b), 'C');
BOOST_CHECK_EQUAL(*(++b), 'G');
BOOST_CHECK_EQUAL(s.size(), 4);
BOOST_CHECK(++b == s.end());
}
BOOST_AUTO_TEST_CASE(constructor_char_pointer)
{
seq s("ATCG");
auto b = s.cbegin();
BOOST_CHECK_EQUAL( *b , 'A');
BOOST_CHECK_EQUAL(*(++b), 'T');
BOOST_CHECK_EQUAL(*(++b), 'C');
BOOST_CHECK_EQUAL(*(++b), 'G');
BOOST_CHECK_EQUAL(s.size(), 4);
BOOST_CHECK(++b == s.end());
}
// BOOST_AUTO_TEST_CASE_TEMPLATE(copy_constructor, T, seq_types)
// {
// T seq("ATCG");
// T copy(seq);
// BOOST_CHECK_EQUAL(copy.size(), 4);
// auto b = copy.cbegin();
// BOOST_CHECK_EQUAL( *b , 'A');
// BOOST_CHECK_EQUAL(*(++b), 'T');
// BOOST_CHECK_EQUAL(*(++b), 'C');
// BOOST_CHECK_EQUAL(*(++b), 'G');
// }
// BOOST_AUTO_TEST_CASE_TEMPLATE(move_constructor, T, seq_types)
// {
// T seq("ATCG");
// T moved(std::move(seq));
// BOOST_CHECK( seq.empty() );
// BOOST_CHECK_EQUAL(moved.size(), 4);
// auto b = moved.cbegin();
// BOOST_CHECK_EQUAL( *b , 'A');
// BOOST_CHECK_EQUAL(*(++b), 'T');
// BOOST_CHECK_EQUAL(*(++b), 'C');
// BOOST_CHECK_EQUAL(*(++b), 'G');
// }
// BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_initializer_list, T, seq_types)
// {
// T seq{ 'A', 'T', 'C', 'G'};
// auto b = seq.cbegin();
// BOOST_CHECK_EQUAL( *b , 'A');
// BOOST_CHECK_EQUAL(*(++b), 'T');
// BOOST_CHECK_EQUAL(*(++b), 'C');
// BOOST_CHECK_EQUAL(*(++b), 'G');
// BOOST_CHECK_EQUAL(seq.size(), 4);
// }
BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment