blob: 3cfc6a6eb06cfb3b60b975e66c8d5e250c4819d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_STRUCTURAL_SVM_PRObLEM_THREADED_ABSTRACT_Hh_
#ifdef DLIB_STRUCTURAL_SVM_PRObLEM_THREADED_ABSTRACT_Hh_
#include "structural_svm_problem_abstract.h"
#include "../matrix.h"
namespace dlib
{
// ----------------------------------------------------------------------------------------
template <
typename matrix_type_,
typename feature_vector_type_ = matrix_type_
>
class structural_svm_problem_threaded : public structural_svm_problem<matrix_type_,feature_vector_type_>
{
public:
/*!
WHAT THIS OBJECT REPRESENTS
This object is identical to the structural_svm_problem object defined in
dlib/svm/structural_svm_problem_abstract.h except that its constructor
takes a number which defines how many threads will be used to make concurrent
calls to the separation_oracle() routine.
So this object lets you take advantage of a multi-core system. You should
set the num_threads parameter equal to the number of available cores. Note
that the separation_oracle() function which you provide must be thread safe
if you are to use this version of the structural_svm_problem. In
particular, it must be safe to call separation_oracle() concurrently from
different threads. However, it is guaranteed that different threads will
never make concurrent calls to separation_oracle() using the same idx value
(i.e. the first argument).
!*/
typedef matrix_type_ matrix_type;
typedef typename matrix_type::type scalar_type;
typedef feature_vector_type_ feature_vector_type;
structural_svm_problem (
unsigned long num_threads
);
/*!
ensures
- this object is properly initialized
- #get_num_threads() == num_threads
!*/
unsigned long get_num_threads (
) const;
/*!
ensures
- Returns the number of threads which will be used to make concurrent
calls to the separation_oracle() function.
!*/
};
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_STRUCTURAL_SVM_PRObLEM_THREADED_ABSTRACT_Hh_
|