Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
c029470a
Commit
c029470a
authored
Sep 03, 2020
by
Cedric Caffy
Browse files
[lto_rao] Computed the costs between all the files
parent
c13af0b6
Changes
4
Hide whitespace changes
Inline
Side-by-side
tapeserver/castor/tape/tapeserver/RAO/RAOFile.cpp
View file @
c029470a
...
...
@@ -46,6 +46,10 @@ FilePositionInfos RAOFile::getFilePositionInfos() const{
return
m_filePositionInfos
;
}
void
RAOFile
::
addDistanceToFile
(
const
double
distance
,
const
RAOFile
&
file
){
m_distancesWithOtherFiles
.
push_back
(
std
::
make_pair
(
distance
,
file
.
getIndex
()));
}
RAOFile
::~
RAOFile
()
{
}
...
...
tapeserver/castor/tape/tapeserver/RAO/RAOFile.hpp
View file @
c029470a
...
...
@@ -18,6 +18,9 @@
#pragma once
#include
<utility>
#include
<list>
#include
"FilePositionInfos.hpp"
namespace
castor
{
namespace
tape
{
namespace
tapeserver
{
namespace
rao
{
...
...
@@ -29,10 +32,13 @@ public:
RAOFile
&
operator
=
(
const
RAOFile
&
other
);
uint64_t
getIndex
()
const
;
FilePositionInfos
getFilePositionInfos
()
const
;
void
addDistanceToFile
(
const
double
distance
,
const
RAOFile
&
file
);
virtual
~
RAOFile
();
typedef
std
::
pair
<
double
,
uint64_t
>
DistanceToFile
;
private:
uint64_t
m_index
;
FilePositionInfos
m_filePositionInfos
;
std
::
list
<
DistanceToFile
>
m_distancesWithOtherFiles
;
};
}}}}
tapeserver/castor/tape/tapeserver/RAO/SLTFRAOAlgorithm.cpp
View file @
c029470a
...
...
@@ -20,7 +20,6 @@
#include
"InterpolationFilePositionEstimator.hpp"
#include
"RAOHelpers.hpp"
#include
"CTACostHeuristic.hpp"
#include
"RAOFile.hpp"
namespace
castor
{
namespace
tape
{
namespace
tapeserver
{
namespace
rao
{
...
...
@@ -29,11 +28,9 @@ SLTFRAOAlgorithm::SLTFRAOAlgorithm() {}
std
::
vector
<
uint64_t
>
SLTFRAOAlgorithm
::
performRAO
(
const
std
::
vector
<
std
::
unique_ptr
<
cta
::
RetrieveJob
>
>&
jobs
)
{
std
::
vector
<
uint64_t
>
ret
;
//Determine all the files position
std
::
vector
<
RAOFile
>
files
;
for
(
uint64_t
i
=
0
;
i
<
jobs
.
size
();
++
i
){
files
.
push_back
(
RAOFile
(
i
,
m_filePositionEstimator
->
getFilePosition
(
*
(
jobs
.
at
(
i
)))));
}
//Determine the matrix of the costs between each file
std
::
vector
<
RAOFile
>
files
=
computeAllFilesPosition
(
jobs
);
computeCostBetweenAllFiles
(
files
);
return
ret
;
}
...
...
@@ -80,6 +77,31 @@ void SLTFRAOAlgorithm::Builder::initializeCostHeuristic() {
}
}
std
::
vector
<
RAOFile
>
SLTFRAOAlgorithm
::
computeAllFilesPosition
(
const
std
::
vector
<
std
::
unique_ptr
<
cta
::
RetrieveJob
>
>&
jobs
)
const
{
std
::
vector
<
RAOFile
>
files
;
for
(
uint64_t
i
=
0
;
i
<
jobs
.
size
();
++
i
){
files
.
push_back
(
RAOFile
(
i
,
m_filePositionEstimator
->
getFilePosition
(
*
(
jobs
.
at
(
i
)))));
}
return
files
;
}
void
SLTFRAOAlgorithm
::
computeCostBetweenAllFiles
(
std
::
vector
<
RAOFile
>
&
files
)
const
{
for
(
uint64_t
i
=
0
;
i
<
files
.
size
();
++
i
){
auto
&
sourceFile
=
files
.
at
(
i
);
for
(
uint64_t
j
=
0
;
j
<
files
.
size
();
++
j
){
//We don't want the distance between the same file
if
(
i
!=
j
){
auto
&
destinationFile
=
files
.
at
(
j
);
double
distanceToFileJ
=
m_costHeuristic
->
getCost
(
sourceFile
.
getFilePositionInfos
(),
destinationFile
.
getFilePositionInfos
());
files
.
at
(
i
).
addDistanceToFile
(
distanceToFileJ
,
destinationFile
);
}
}
}
}
std
::
vector
<
uint64_t
>
SLTFRAOAlgorithm
::
performSLTF
(
const
std
::
vector
<
RAOFile
>&
files
)
const
{
//TODO
return
std
::
vector
<
uint64_t
>
();
}
}}}}
\ No newline at end of file
tapeserver/castor/tape/tapeserver/RAO/SLTFRAOAlgorithm.hpp
View file @
c029470a
...
...
@@ -23,6 +23,7 @@
#include
"CostHeuristic.hpp"
#include
"FilePositionEstimator.hpp"
#include
"castor/tape/tapeserver/drive/DriveInterface.hpp"
#include
"RAOFile.hpp"
namespace
castor
{
namespace
tape
{
namespace
tapeserver
{
namespace
rao
{
...
...
@@ -48,6 +49,11 @@ private:
SLTFRAOAlgorithm
();
std
::
unique_ptr
<
FilePositionEstimator
>
m_filePositionEstimator
;
std
::
unique_ptr
<
CostHeuristic
>
m_costHeuristic
;
std
::
vector
<
RAOFile
>
computeAllFilesPosition
(
const
std
::
vector
<
std
::
unique_ptr
<
cta
::
RetrieveJob
>
>
&
jobs
)
const
;
void
computeCostBetweenAllFiles
(
std
::
vector
<
RAOFile
>
&
files
)
const
;
std
::
vector
<
uint64_t
>
performSLTF
(
const
std
::
vector
<
RAOFile
>
&
files
)
const
;
};
}}}}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment