Skip to content

Update LLM prompt for sparse_axpy to reflect the output 'z' as a dense vector #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,878 changes: 1,439 additions & 1,439 deletions prompts/generation-prompts.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions prompts/raw/sparse_la/48_sparse_la_sparse_axpy/cuda
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ struct Element {
double value;
};

/* Compute z = alpha*x+y where x and y are sparse vectors of size Nx and Ny. Store the result in z.
/* 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.
Use CUDA to compute in parallel. The kernel is launched with at least as many threads as values in x or y.
Example:

input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
*/
__global__ void sparseAxpy(double alpha, const Element *x, const Element *y, double *z, size_t Nx, size_t Ny, size_t N) {
4 changes: 2 additions & 2 deletions prompts/raw/sparse_la/48_sparse_la_sparse_axpy/hip
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ struct Element {
double value;
};

/* Compute z = alpha*x+y where x and y are sparse vectors of size Nx and Ny. Store the result in z.
/* 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.
Use AMD HIP to compute in parallel. The kernel is launched with at least as many threads as values in x or y.
Example:

input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
*/
__global__ void sparseAxpy(double alpha, const Element *x, const Element *y, double *z, size_t Nx, size_t Ny, size_t N) {
4 changes: 2 additions & 2 deletions prompts/raw/sparse_la/48_sparse_la_sparse_axpy/kokkos
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ struct Element {
double value;
};

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

input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
*/
void sparseAxpy(double alpha, Kokkos::View<const Element*> &x, Kokkos::View<const Element*> &y, Kokkos::View<double*> &z) {
4 changes: 2 additions & 2 deletions prompts/raw/sparse_la/48_sparse_la_sparse_axpy/mpi
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ struct Element {
double value;
};

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

input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
*/
void sparseAxpy(double alpha, std::vector<Element> const& x, std::vector<Element> const& y, std::vector<double> &z) {
4 changes: 2 additions & 2 deletions prompts/raw/sparse_la/48_sparse_la_sparse_axpy/mpi+omp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ struct Element {
double value;
};

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

input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
*/
void sparseAxpy(double alpha, std::vector<Element> const& x, std::vector<Element> const& y, std::vector<double> &z) {
4 changes: 2 additions & 2 deletions prompts/raw/sparse_la/48_sparse_la_sparse_axpy/omp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ struct Element {
double value;
};

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

input: x=[{5, 12}, {8, 3}, {12, -1}], y=[{3, 1}, {5, -2}, {7, 1}, {8, -3}], alpha=1
output: z=[{3, 1}, {5, 10}, {7, 1}, {12, -1}]
output: z=[0, 0, 0, 1, 0, 10, 0, 1, 0, 0, 0, 0, -1]
*/
void sparseAxpy(double alpha, std::vector<Element> const& x, std::vector<Element> const& y, std::vector<double> &z) {
4 changes: 2 additions & 2 deletions prompts/raw/sparse_la/48_sparse_la_sparse_axpy/serial
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ struct Element {
double value;
};

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

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