Skip to content

Commit 767980f

Browse files
Update LLM prompt for sparse_axpy to reflect the output 'z' as a dense vector (#34)
* Update LLM prompt for sparse_axpy to reflect the output 'z' as a dense vector. * explicitly denote z as dense * update prompts json --------- Co-authored-by: Daniel Nichols <dando18studios@gmail.com>
1 parent 3fea3f5 commit 767980f

8 files changed

Lines changed: 1453 additions & 1453 deletions

File tree

prompts/generation-prompts.json

Lines changed: 1439 additions & 1439 deletions
Large diffs are not rendered by default.

prompts/raw/sparse_la/48_sparse_la_sparse_axpy/cuda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ struct Element {
33
double value;
44
};
55

6-
/* Compute z = alpha*x+y where x and y are sparse vectors of size Nx and Ny. Store the result in z.
6+
/* Compute z = alpha*x+y where x and y are sparse vectors of size Nx and Ny. Store the result in the dense vector z.
77
Use CUDA to compute in parallel. The kernel is launched with at least as many threads as values in x or y.
88
Example:
99

1010
input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
11-
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
11+
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
1212
*/
1313
__global__ void sparseAxpy(double alpha, const Element *x, const Element *y, double *z, size_t Nx, size_t Ny, size_t N) {

prompts/raw/sparse_la/48_sparse_la_sparse_axpy/hip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ struct Element {
33
double value;
44
};
55

6-
/* Compute z = alpha*x+y where x and y are sparse vectors of size Nx and Ny. Store the result in z.
6+
/* Compute z = alpha*x+y where x and y are sparse vectors of size Nx and Ny. Store the result in the dense vector z.
77
Use AMD HIP to compute in parallel. The kernel is launched with at least as many threads as values in x or y.
88
Example:
99

1010
input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
11-
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
11+
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
1212
*/
1313
__global__ void sparseAxpy(double alpha, const Element *x, const Element *y, double *z, size_t Nx, size_t Ny, size_t N) {

prompts/raw/sparse_la/48_sparse_la_sparse_axpy/kokkos

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ struct Element {
33
double value;
44
};
55

6-
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in z.
6+
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in the dense vector z.
77
Use Kokkos to compute in parallel. Assume Kokkos has already been initialized.
88
Example:
99

1010
input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
11-
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
11+
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
1212
*/
1313
void sparseAxpy(double alpha, Kokkos::View<const Element*> &x, Kokkos::View<const Element*> &y, Kokkos::View<double*> &z) {

prompts/raw/sparse_la/48_sparse_la_sparse_axpy/mpi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ struct Element {
33
double value;
44
};
55

6-
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in z.
6+
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in the dense vector z.
77
Use MPI to compute in parallel. Assume MPI has already been initialized.
88
Every rank has a complete copy of x and y. Store the result in z on rank 0.
99
Example:
1010

1111
input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
12-
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
12+
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
1313
*/
1414
void sparseAxpy(double alpha, std::vector<Element> const& x, std::vector<Element> const& y, std::vector<double> &z) {

prompts/raw/sparse_la/48_sparse_la_sparse_axpy/mpi+omp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ struct Element {
33
double value;
44
};
55

6-
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in z.
6+
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in the dense vector z.
77
Use MPI and OpenMP to compute in parallel. Assume MPI has already been initialized.
88
Every rank has a complete copy of x and y. Store the result in z on rank 0.
99
Example:
1010

1111
input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
12-
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
12+
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
1313
*/
1414
void sparseAxpy(double alpha, std::vector<Element> const& x, std::vector<Element> const& y, std::vector<double> &z) {

prompts/raw/sparse_la/48_sparse_la_sparse_axpy/omp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ struct Element {
33
double value;
44
};
55

6-
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in z.
6+
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in the dense vector z.
77
Use OpenMP to compute in parallel.
88
Example:
99

1010
input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
11-
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
11+
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
1212
*/
1313
void sparseAxpy(double alpha, std::vector<Element> const& x, std::vector<Element> const& y, std::vector<double> &z) {

prompts/raw/sparse_la/48_sparse_la_sparse_axpy/serial

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ struct Element {
33
double value;
44
};
55

6-
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in z.
6+
/* Compute z = alpha*x+y where x and y are sparse vectors. Store the result in the dense vector z.
77
Example:
88

99
input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
10-
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
10+
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
1111
*/
1212
void sparseAxpy(double alpha, std::vector<Element> const& x, std::vector<Element> const& y, std::vector<double> &z) {

0 commit comments

Comments
 (0)