Commit d2ced9a4 authored by Michael R. Crusoe's avatar Michael R. Crusoe
Browse files

New upstream version 2.2.8

parent 37545beb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -146,7 +146,8 @@ AM_SH_LOG_FLAGS =
TESTS = tests/generate_sequence.sh tests/parallel_hashing.sh	\
        tests/merge.sh tests/bloom_filter.sh tests/big.sh	\
        tests/subset_hashing.sh tests/multi_file.sh		\
        tests/bloom_counter.sh tests/large_key.sh tests/sam.sh
        tests/bloom_counter.sh tests/large_key.sh tests/sam.sh	\
        tests/small_mers.sh

EXTRA_DIST += $(TESTS)
clean-local: clean-local-check
@@ -164,6 +165,7 @@ tests/min_qual.log: tests/generate_fastq_sequence.log
tests/large_key.log: tests/generate_sequence.log
tests/quality_filter.log: tests/generate_sequence.log
tests/sam.log: tests/generate_sequence.log
tests/small_mers.log: tests/generate_sequence.log

# SWIG tests
TESTS += tests/swig_python.sh tests/swig_ruby.sh tests/swig_perl.sh
+13 −6
Original line number Diff line number Diff line
AC_INIT([jellyfish], [2.2.7], [gmarcais@umd.edu])
AC_INIT([jellyfish], [2.2.8], [gmarcais@umd.edu])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([subdir-objects foreign parallel-tests color-tests])
@@ -10,18 +10,23 @@ AC_LIB_RPATH
PKG_PROG_PKG_CONFIG

# Change default compilation flags
AC_SUBST([ALL_CXXFLAGS], [-std=c++0x])
CXXFLAGS="-std=c++0x $CXXFLAGS"
AC_LANG(C++)
AC_PROG_CXX

# Major version of the library
AC_SUBST([PACKAGE_LIB], [2.0])

# Check if gnu++11 is necessary
save_CXXFLAGS=$CXXFLAGS
AC_CANONICAL_HOST
case "${host_os}" in
     cygwin*) CXXFLAGS="-std=gnu++11 $save_CXXFLAGS" ;;
     *) CXXFLAGS="-std=c++11 $save_CXXFLAGS" ;;
esac

# Try to find htslib to read SAM/BAM/CRAM files
AC_ARG_ENABLE([htslib],
              [AS_HELP_STRING([--enable-htslib], [Look for the HTS library (default=yes)])])
echo "enable_htslib $enable_htslib"
AS_IF([test "x$enable_htslib" = "xyes" -o "x$enable_htslib" = "x"],
      [PKG_CHECK_MODULES([HTSLIB], [htslib], [AC_DEFINE([HAVE_HTSLIB], [1], [Defined if htslib is available])], [true])]
      [AC_LIB_LINKFLAGS_FROM_LIBS([HTSLIB_RPATH], [$HTSLIB_LIBS], [LIBTOOL])])
@@ -88,8 +93,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mach-o/dyld.h>]],
                  [AC_DEFINE([HAVE_NSGETEXECUTABLEPATH], [1], [Used to find executable path on MacOS X])],
                  [AC_MSG_RESULT([no])])

# Check the version of strerror_r
AC_CHECK_HEADERS_ONCE([execinfo.h ext/stdio_filebuf.h])
AC_CHECK_HEADERS_ONCE([execinfo.h ext/stdio_filebuf.h sys/syscall.h])
AC_CHECK_MEMBER([siginfo_t.si_int],
                [AC_DEFINE([HAVE_SI_INT], [1], [Define if siginfo_t.si_int exists])],
                [], [[#include <signal.h>]])
@@ -134,6 +138,9 @@ AM_CONDITIONAL(PYTHON_BINDING, [test -n "$enable_python_binding" -a x$enable_pyt
AM_COND_IF([PYTHON_BINDING],
           [AS_IF([test x$enable_python_binding != xyes], [PYTHON_SITE_PKG=$enable_python_binding])]
           [AX_PYTHON_DEVEL([], [$prefix])])
AC_ARG_ENABLE([python-deprecated],
              [AC_HELP_STRING([--enable-python-deprecated], [enable the deprecated 'jellyfish' module (in addition to 'dna_jellyfish')])])
AM_CONDITIONAL([PYTHON_DEPRECATED], [test -z "$enable_python_deprecated" -o x$enable_python_deprecated != xno])

# Ruby binding setup
AS_IF([test -z "$enable_ruby_binding"], [enable_ruby_binding="$enable_all_binding"])
+11 −3
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@ public:
    name += std::to_string((long long int)i); // Cast to make gcc4.4 happy!
    const unsigned int r = root_[name]["r"].asUInt();
    const unsigned int c = root_[name]["c"].asUInt();
    if(root_[name]["identity"].asBool())
      return RectangularBinaryMatrix::identity(r, c);

    std::vector<uint64_t> raw(c, (uint64_t)0);
    for(unsigned int i = 0; i < c; ++i)
      raw[i] = root_[name]["columns"][i].asUInt64();
@@ -57,11 +60,16 @@ public:
    root_[name].clear();
    root_[name]["r"] = m.r();
    root_[name]["c"] = m.c();
    if(m.is_low_identity()) {
      root_[name]["identity"] = true;
    } else {
      root_[name]["identity"] = false;
      for(unsigned int i = 0; i < m.c(); ++i) {
        Json::UInt64 x = m[i];
        root_[name]["columns"].append(x);
      }
    }
  }

  size_t size() const { return root_["size"].asLargestUInt(); }
  void size(size_t s) { root_["size"] = (Json::UInt64)s; }
+13 −10
Original line number Diff line number Diff line
@@ -204,8 +204,15 @@ protected:
  bool double_size(bool serial_thread) {
    if(serial_thread) {// Allocate new array for size doubling
      try {
        if(ary_->key_len() >= sizeof(size_t) * 8 || ary_->size() < ((size_t)1 << ary_->key_len())) {
          // Increase number of keys
          new_ary_   = new array(ary_->size() * 2, ary_->key_len(), ary_->val_len(),
                                 ary_->max_reprobe(), ary_->reprobes());
        } else {
          // Array is already maximum compared to key len, increase val_len
          new_ary_ = new  array(ary_->size(), ary_->key_len(), ary_->val_len() + 1,
                                ary_->max_reprobe(), ary_->reprobes());
        }
      } catch(typename array::ErrorAllocation e) {
        new_ary_ = 0;
      }
@@ -219,10 +226,6 @@ protected:

    // Copy data from old to new
    uint16_t       id = atomic_t::fetch_add(&size_thid_, (uint16_t)1);
    // Why doesn't the following work? Seems like a bug to
    // me. Equivalent call works in test_large_hash_array. Or am I
    // missing something?
    // eager_iterator it = ary_->iterator_slice<eager_iterator>(id, nb_threads_);
    eager_iterator it = ary_->eager_slice(id, nb_threads_);
    while(it.next())
      my_ary->add(it.key(), it.val());
+54 −13
Original line number Diff line number Diff line
@@ -930,25 +930,37 @@ public:

};

template<typename Key, typename word = uint64_t, typename atomic_t = ::atomic::gcc, typename mem_block_t = ::allocators::mmap>
class array :
// Large array. Memory managed by the mmap allocator. Do not check the
// relation between the size of the array and key_len.
template<typename Key, typename word = uint64_t,
         typename atomic_t = ::atomic::gcc, typename mem_block_t = ::allocators::mmap>
class unbounded_array  :
    protected mem_block_t,
    public array_base<Key, word, atomic_t, array<Key, word, atomic_t, mem_block_t> >
    public array_base<Key, word, atomic_t, unbounded_array<Key, word, atomic_t, mem_block_t> >
{
  typedef array_base<Key, word, atomic_t, array<Key, word, atomic_t, mem_block_t> > super;
  friend class array_base<Key, word, atomic_t, array<Key, word, atomic_t, mem_block_t> >;
  typedef array_base<Key, word, atomic_t, unbounded_array<Key, word, atomic_t, mem_block_t> > super;
  friend class array_base<Key, word, atomic_t, unbounded_array<Key, word, atomic_t, mem_block_t> >;

public:
  array(size_t size, // Size of hash. To be rounded up to a power of 2
  unbounded_array(size_t size, // Size of hash. To be rounded up to a power of 2
                  uint16_t key_len, // Size of key in bits
                  uint16_t val_len, // Size of val in bits
                  uint16_t reprobe_limit, // Maximum reprobe
        const size_t* reprobes = quadratic_reprobes) : // Reprobing policy
    mem_block_t(),
    super(size, key_len, val_len, reprobe_limit, RectangularBinaryMatrix(ceilLog2(size), key_len).randomize_pseudo_inverse(),
                  const size_t* reprobes = quadratic_reprobes) // Reprobing policy
    : super(size, key_len, val_len, reprobe_limit,
            RectangularBinaryMatrix(ceilLog2(size), key_len).randomize_pseudo_inverse(),
            reprobes)
  { }

    unbounded_array(size_t size, // Size of hash. To be rounded up to a power of 2
                    uint16_t key_len, // Size of key in bits
                    uint16_t val_len, // Size of val in bits
                    uint16_t reprobe_limit, // Maximum reprobe
                    RectangularBinaryMatrix&& m, // Hashing matrix
                    const size_t* reprobes = quadratic_reprobes) // Reprobing policy
      : super(size, key_len, val_len, reprobe_limit, m, reprobes)
  { }

protected:
  word* alloc_data(size_t s) {
    mem_block_t::realloc(s);
@@ -956,6 +968,35 @@ protected:
  }
};

// Large array. Memory managed by the mmap allocator, bound the size
// of the array if the key_len is small.
template<typename Key, typename word = uint64_t,
         typename atomic_t = ::atomic::gcc, typename mem_block_t = ::allocators::mmap>
class array : public unbounded_array<Key, word, atomic_t, mem_block_t>
{
  typedef unbounded_array<Key, word, atomic_t, mem_block_t> super;

  static size_t key_len_size(uint16_t key_len) {
    return key_len >= std::numeric_limits<size_t>::digits ? std::numeric_limits<size_t>::max() / 2 : (size_t)1 << key_len;
  }

public:
  array(size_t size, // Size of hash. To be rounded up to a power of 2
        uint16_t key_len, // Size of key in bits
        uint16_t val_len, // Size of val in bits
        uint16_t reprobe_limit, // Maximum reprobe
        const size_t* reprobes = quadratic_reprobes) : // Reprobing policy
    super(std::min(size, key_len_size(key_len)), key_len, val_len, reprobe_limit,
          (size < key_len_size(key_len))
          ? RectangularBinaryMatrix(ceilLog2(size), key_len).randomize_pseudo_inverse()
          : RectangularBinaryMatrix::identity(key_len),
          reprobes)
  {
    //    std::cerr << this->size() << ' ' << this->val_len() << '\n';
  }

};

struct ptr_info {
  void*  ptr_;
  size_t bytes_;
Loading