Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
P3
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
P3
Validations
110e0e84
Valider
110e0e84
rédigé
Il y a 2 semaines
par
JordanHanotiaux
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
up
parent
27830ca7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
main.cpp
+8
-1
8 ajouts, 1 suppression
main.cpp
matrix_opencl.cpp
+8
-8
8 ajouts, 8 suppressions
matrix_opencl.cpp
avec
16 ajouts
et
9 suppressions
main.cpp
+
8
−
1
Voir le fichier @
110e0e84
...
@@ -106,7 +106,14 @@ int main(int argc, char** argv) {
...
@@ -106,7 +106,14 @@ int main(int argc, char** argv) {
std
::
cout
<<
"Using Device: "
<<
device
.
getInfo
<
CL_DEVICE_NAME
>
()
<<
std
::
endl
;
std
::
cout
<<
"Using Device: "
<<
device
.
getInfo
<
CL_DEVICE_NAME
>
()
<<
std
::
endl
;
cl
::
Context
context
(
device
);
cl
::
Context
context
(
device
);
cl
::
CommandQueue
queue
(
context
,
device
,
CL_QUEUE_PROFILING_ENABLE
);
// Keep profiling enabled
cl_int
err
;
cl_command_queue
cq
=
clCreateCommandQueue
(
context
(),
device
(),
CL_QUEUE_PROFILING_ENABLE
,
&
err
);
if
(
err
!=
CL_SUCCESS
)
{
std
::
cerr
<<
"Failed to create command queue: "
<<
err
<<
std
::
endl
;
exit
(
1
);
}
cl
::
CommandQueue
queue
(
cq
,
true
);
std
::
vector
<
cl
::
Device
>
devices_to_init
=
{
device
};
std
::
vector
<
cl
::
Device
>
devices_to_init
=
{
device
};
try
{
try
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
matrix_opencl.cpp
+
8
−
8
Voir le fichier @
110e0e84
...
@@ -77,7 +77,7 @@ const std::string kernel_source_transpose = R"(
...
@@ -77,7 +77,7 @@ const std::string kernel_source_transpose = R"(
}
}
)"
;
)"
;
// NAIVE
// NAIVE
/*
const std::string kernel_source_matrix_mul = R"(
const
std
::
string
kernel_source_matrix_mul
=
R"(
__kernel void matrix_mul(__global const float* A, __global const float* B, __global float* C, int A_rows, int A_cols, int B_cols) {
__kernel void matrix_mul(__global const float* A, __global const float* B, __global float* C, int A_rows, int A_cols, int B_cols) {
int row = get_global_id(0);
int row = get_global_id(0);
int col = get_global_id(1);
int col = get_global_id(1);
...
@@ -85,10 +85,10 @@ const std::string kernel_source_transpose = R"(
...
@@ -85,10 +85,10 @@ const std::string kernel_source_transpose = R"(
C[row * B_cols + col] += A[row * A_cols + k] * B[k * B_cols + col];
C[row * B_cols + col] += A[row * A_cols + k] * B[k * B_cols + col];
}
}
}
}
)";
*/
)"
;
// FASTER
// FASTER
const
std
::
string
kernel_source_matrix_mul
=
R"(
/*
const std::string kernel_source_matrix_mul = R"(
__kernel void matrix_mul(__global const float* A,
__kernel void matrix_mul(__global const float* A,
__global const float* B,
__global const float* B,
__global float* C,
__global float* C,
...
@@ -120,7 +120,7 @@ const std::string kernel_source_matrix_mul = R"(
...
@@ -120,7 +120,7 @@ const std::string kernel_source_matrix_mul = R"(
barrier(CLK_LOCAL_MEM_FENCE);
barrier(CLK_LOCAL_MEM_FENCE);
}
}
})"
;
})";
*/
const
std
::
string
kernel_source_sigmoid
=
R"(
const
std
::
string
kernel_source_sigmoid
=
R"(
__kernel void sigmoid(__global const float* input, __global float* output, int rows, int cols) {
__kernel void sigmoid(__global const float* input, __global float* output, int rows, int cols) {
int idx = get_global_id(0);
int idx = get_global_id(0);
...
@@ -348,7 +348,7 @@ MatrixCL MatrixCL::operator+(const MatrixCL& other) const {
...
@@ -348,7 +348,7 @@ MatrixCL MatrixCL::operator+(const MatrixCL& other) const {
}
}
// NAIVE VERSION
// NAIVE VERSION
/*
MatrixCL MatrixCL::operator*(const MatrixCL& other) const {
MatrixCL
MatrixCL
::
operator
*
(
const
MatrixCL
&
other
)
const
{
if
(
cols_
!=
other
.
rows_
)
if
(
cols_
!=
other
.
rows_
)
throw
std
::
runtime_error
(
"Matrix dimension error."
);
throw
std
::
runtime_error
(
"Matrix dimension error."
);
...
@@ -368,10 +368,10 @@ MatrixCL MatrixCL::operator+(const MatrixCL& other) const {
...
@@ -368,10 +368,10 @@ MatrixCL MatrixCL::operator+(const MatrixCL& other) const {
}
}
return
result
;
return
result
;
}
*/
}
// FASTER VERSION
// FASTER VERSION
MatrixCL
MatrixCL
::
operator
*
(
const
MatrixCL
&
other
)
const
{
/*
MatrixCL MatrixCL::operator*(const MatrixCL& other) const {
if (cols_ != other.rows_)
if (cols_ != other.rows_)
throw std::runtime_error("Matrix dimension error.");
throw std::runtime_error("Matrix dimension error.");
...
@@ -404,7 +404,7 @@ MatrixCL MatrixCL::operator*(const MatrixCL& other) const {
...
@@ -404,7 +404,7 @@ MatrixCL MatrixCL::operator*(const MatrixCL& other) const {
}
}
return result;
return result;
}
}
*/
MatrixCL
MatrixCL
::
transpose
()
const
{
MatrixCL
MatrixCL
::
transpose
()
const
{
...
...
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