Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
S
SC2710
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Conditions générales et politique de confidentialité
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Jordan Hanotiaux
SC2710
Validations
c7ac8bef
Valider
c7ac8bef
rédigé
Il y a 1 mois
par
JordanHanotiaux
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Update distributedmatrix.cpp
parent
7688fd0a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
P2/distributedmatrix.cpp
+10
-10
10 ajouts, 10 suppressions
P2/distributedmatrix.cpp
avec
10 ajouts
et
10 suppressions
P2/distributedmatrix.cpp
+
10
−
10
Voir le fichier @
c7ac8bef
...
@@ -54,14 +54,14 @@ int DistributedMatrix::numCols() const {
...
@@ -54,14 +54,14 @@ int DistributedMatrix::numCols() const {
double
DistributedMatrix
::
get
(
int
i
,
int
j
)
const
{
double
DistributedMatrix
::
get
(
int
i
,
int
j
)
const
{
if
(
j
<
startCol
||
j
>=
startCol
+
localCols
)
{
if
(
j
<
startCol
||
j
>=
startCol
+
localCols
)
{
throw
std
::
out_of_range
(
"
Attempt to access non-local column in get()
"
);
throw
std
::
out_of_range
(
"
Out of range.
"
);
}
}
return
localData
.
get
(
i
,
j
-
startCol
);
return
localData
.
get
(
i
,
j
-
startCol
);
}
}
void
DistributedMatrix
::
set
(
int
i
,
int
j
,
double
value
)
{
void
DistributedMatrix
::
set
(
int
i
,
int
j
,
double
value
)
{
if
(
j
<
startCol
||
j
>=
startCol
+
localCols
)
{
if
(
j
<
startCol
||
j
>=
startCol
+
localCols
)
{
throw
std
::
out_of_range
(
"
Attempt to access non-local column in set(
)"
);
throw
std
::
out_of_range
(
"
Out of range.
)"
);
}
}
localData
.
set
(
i
,
j
-
startCol
,
value
);
localData
.
set
(
i
,
j
-
startCol
,
value
);
}
}
...
@@ -79,16 +79,17 @@ int DistributedMatrix::localColIndex(int globalColIndex) const {
...
@@ -79,16 +79,17 @@ int DistributedMatrix::localColIndex(int globalColIndex) const {
}
}
int
DistributedMatrix
::
ownerProcess
(
int
globalColIndex
)
const
{
int
DistributedMatrix
::
ownerProcess
(
int
globalColIndex
)
const
{
int
remainingCols
=
g
lo
b
al
Cols
%
numProcesses
;
std
::
vector
<
int
>
lo
c
al
StartProcesses
(
numProcesses
)
;
for
(
int
p
=
0
;
p
<
numProcesses
;
++
p
)
{
MPI_Allgather
(
&
startCol
,
1
,
MPI_INT
,
localStartProcesses
.
data
(),
1
,
MPI_INT
,
MPI_COMM_WORLD
);
int
start
=
p
*
localCols
+
min
(
p
,
remainingCols
);
int
cols
=
localCols
+
(
p
<
remainingCols
?
1
:
0
);
for
(
int
p
=
1
;
p
<
numProcesses
;
++
p
)
{
if
(
globalColIndex
>=
start
&&
globalColIndex
<
start
+
cols
)
{
if
(
globalColIndex
>=
localStartProcesses
[
p
-
1
]
&&
globalColIndex
<
localStartProcesses
[
p
]
)
{
return
p
;
return
p
-
1
;
}
}
}
}
return
0
;
return
numProcesses
-
1
;
}
}
const
Matrix
&
DistributedMatrix
::
getLocalData
()
const
{
const
Matrix
&
DistributedMatrix
::
getLocalData
()
const
{
...
@@ -240,7 +241,6 @@ Matrix DistributedMatrix::multiplyTransposed(const DistributedMatrix &other) con
...
@@ -240,7 +241,6 @@ Matrix DistributedMatrix::multiplyTransposed(const DistributedMatrix &other) con
}
}
void
sync_matrix
(
Matrix
*
matrix
,
int
rank
,
int
src
)
{
void
sync_matrix
(
Matrix
*
matrix
,
int
rank
,
int
src
)
{
// Utiliser const_cast pour supprimer le qualificatif const, car MPI_Bcast nécessite un void*
MPI_Bcast
(
const_cast
<
double
*>
(
matrix
->
getData
().
data
()),
matrix
->
numRows
()
*
matrix
->
numCols
(),
MPI_DOUBLE
,
src
,
MPI_COMM_WORLD
);
MPI_Bcast
(
const_cast
<
double
*>
(
matrix
->
getData
().
data
()),
matrix
->
numRows
()
*
matrix
->
numCols
(),
MPI_DOUBLE
,
src
,
MPI_COMM_WORLD
);
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter