[med-svn] [freecontact] 01/01: addressing bugs concerning SSE2 instructions, and =item perlpod usage
Laszlo Kajan
lkajan at alioth.debian.org
Tue Sep 17 18:09:17 UTC 2013
This is an automated email from the git hooks/post-receive script.
lkajan pushed a commit to branch master
in repository freecontact.
commit 68d17825c2c16ceecd0500d3ed7e05e5eb5cc1a8
Author: Laszlo Kajan <lkajan at debian.org>
Date: Tue Sep 17 20:09:06 2013 +0200
addressing bugs concerning SSE2 instructions, and =item perlpod usage
---
.gitignore | 2 +-
debian/control | 2 +-
lib/freecontact.cpp | 30 +++++++++++++++++++++++-------
lib/freecontact.h | 19 +++++--------------
src/freecontact.cpp | 8 ++++----
5 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/.gitignore b/.gitignore
index d63570b..71d1ec0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,7 +23,7 @@ debian/*.substvars
debian/tmp/
depcomp
doxygen-doc/
-.gitignore.swp
+*.swp
help-dummy.o
install-sh
lib/config.h
diff --git a/debian/control b/debian/control
index 912caa9..f9a92a5 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: science
Priority: extra
Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
Uploaders: Laszlo Kajan <lkajan at rostlab.org>
-Build-Depends: debhelper (>= 9.0.0), autotools-dev, bash-completion, gfortran, libblas-dev | libblas-3.so, libboost-dev, libboost-program-options-dev, liblapack-dev | liblapack-3.so, libxerces-c-dev, perl, xsdcxx (>= 3.3)
+Build-Depends: debhelper (>= 9.0.0), automake, bash-completion, gfortran, libblas-dev | libblas-3.so, libboost-dev, libboost-program-options-dev, liblapack-dev | liblapack-3.so, libxerces-c-dev, perl, xsdcxx (>= 3.3)
Build-Depends-Indep: doxygen
Standards-Version: 3.9.4
Homepage: http://rostlab.org/
diff --git a/lib/freecontact.cpp b/lib/freecontact.cpp
index 077ab6a..4fb2795 100644
--- a/lib/freecontact.cpp
+++ b/lib/freecontact.cpp
@@ -14,9 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
+#include "freecontact.h"
-#include <boost/format.hpp>
#ifdef HAVE_OPENMP
#include <omp.h>
#endif
@@ -26,11 +25,9 @@
//#include <memory> // auto_ptr, unique_ptr
#include <signal.h>
#include <stdio.h>
-#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
-#include "freecontact.h"
// lkajan: EVfold-mfDCA is calculate_evolutionary_constraints.m
@@ -187,6 +184,11 @@ static inline vector<contact_t>
static inline uint32_t
_cache_holds_nseq(uint16_t __seqsize);
+#ifndef __SSE2__
+static inline __m128i _mm_setzero_si128(){ __m128i m; long long *mp = (long long *)&m; mp[1] = mp[0] = 0; return m; }
+#endif
+
+
class _glasso_timer {
timer_t _timerid;
@@ -255,7 +257,7 @@ void predictor::get_seq_weights(
// lkajan: allow for other vectorizations as well
#define CAN_VECW 0
- #ifdef HAVE_SSE2
+ #ifdef __SSE2__
#undef CAN_VECW
#define CAN_VECW 1
#endif
@@ -299,7 +301,7 @@ void predictor::get_seq_weights(
}
}
}
- #ifdef HAVE_SSE2
+ #ifdef __SSE2__
else
{
// lkajan: Dynamically set chunk size according to (L1) cache size (cat /sys/devices/system/cpu/cpu0/cache/index*/{coherency_line_size,level,size,type}).
@@ -395,7 +397,7 @@ void predictor::get_seq_weights(
}
#else // should never happen unless bug
else throw std::runtime_error(bo::str(bo::format("ooops, there is a bug in %s around %s:%d") % PACKAGE % __FILE__ % __LINE__ ));
- #endif // HAVE_SSE2
+ #endif // __SSE2__
__wtot = 0; // total weight of all aligments, EVfold-mfDCA::Meff
__aliw = freq_vec_t(__ali.seqcnt); // alignment weight array, EVfold-mfDCA::W
@@ -986,6 +988,20 @@ predictor::cont_res_t
}
+ali_t& ali_t::push(const std::vector<uint8_t>& __al) throw (alilen_error)
+{
+ if( __al.size() != alilen ) throw alilen_error(bo::str(bo::format("alignment length mismatch, expected %d, got %d") % alilen % __al.size() ));
+ resize( ++seqcnt*alilen16, _mm_setzero_si128() );
+
+ uint8_t *alptr = reinterpret_cast<uint8_t*>(data()) + (seqcnt-1) * alilenpad;
+ memcpy(alptr, __al.data(), __al.size());
+
+ if( capacity() == size() )
+ reserve( size() + 1024*alilen16 );
+ return *this;
+}
+
+
/// Calculate raw contact scores using given function and collect row/column/overall mean for APC calculation.
/** \param [out] __raw_ctscore
* \param [out] __apc_bg
diff --git a/lib/freecontact.h b/lib/freecontact.h
index 38b340c..0608213 100644
--- a/lib/freecontact.h
+++ b/lib/freecontact.h
@@ -17,6 +17,8 @@
#ifndef LIBFREECONTACT_H
#define LIBFREECONTACT_H
+#include "config.h"
+
#include <boost/format.hpp>
#include <errno.h>
#include <map>
@@ -24,7 +26,9 @@
#include <stdint.h>
#include <string.h>
#include <vector>
+#ifdef HAVE_X86INTRIN_H
#include <x86intrin.h>
+#endif // HAVE_X86INTRIN_H
#define LIBFREEC_API __attribute__ ((visibility ("default")))
#define LIBFREEC_LOCAL __attribute__ ((visibility ("hidden")))
@@ -61,10 +65,8 @@ class LIBFREEC_API icme_timeout_error : public std::runtime_error {
icme_timeout_error(const std::string& __arg) : std::runtime_error(__arg){}
};
-// For ali_t:
#ifndef __SSE2__
typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
-__m128i _mm_setzero_si128(){ __m128i m; long long *mp = (long long *)&m; mp[1] = mp[0] = 0; return m; }
#endif
/// Protein sequence alignment.
@@ -112,18 +114,7 @@ class LIBFREEC_API ali_t : public std::vector<__m128i>
}
/// Push a sequence to the alignment.
- inline ali_t& push(const std::vector<uint8_t>& __al) throw (alilen_error)
- {
- if( __al.size() != alilen ) throw alilen_error(bo::str(bo::format("alignment length mismatch, expected %d, got %d") % alilen % __al.size() ));
- resize( ++seqcnt*alilen16, _mm_setzero_si128() );
-
- uint8_t *alptr = reinterpret_cast<uint8_t*>(data()) + (seqcnt-1) * alilenpad;
- memcpy(alptr, __al.data(), __al.size());
-
- if( capacity() == size() )
- reserve( size() + 1024*alilen16 );
- return *this;
- }
+ ali_t& push(const std::vector<uint8_t>& __al) throw (alilen_error);
/// Push a sequence to the alignment.
inline ali_t& push(const std::string& __l) throw (alilen_error)
diff --git a/src/freecontact.cpp b/src/freecontact.cpp
index 8440e9d..1c5ddd8 100644
--- a/src/freecontact.cpp
+++ b/src/freecontact.cpp
@@ -339,7 +339,7 @@ PSICOV of D. Jones et al. (2011) [2].
FreeContact is accelerated by a combination of vector instructions, multiple
threads, and faster implementation of key parts.
-Depending on the alignment, 10-fold or higher speedups are possible.
+Depending on the alignment, 8-fold or higher speedups are possible.
A sufficiently large alignment is required for meaningful results.
As a minimum, an alignment with an effective (after-weighting) sequence count
@@ -565,15 +565,15 @@ Print version.
=over
-=item 0
+=item I<0>
No error - success.
-=item 1
+=item I<1>
Unspecified error.
-=item 2
+=item I<2>
A timeout (see B<--icme-timeout>) occurred.
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/freecontact.git
More information about the debian-med-commit
mailing list