#include <stdio.h>
__global__void cuda_print(int m, int n, int **x, char **y)
{
int k=0;
char *STR;
for(int i=0;i<m;i++)
{
for(int j =0;j<n;j++)
{
while(yx[i][j]]--)
{
STR[k++] =
y[i][j];
}
}
}
printf("%s",STR);
}
int main(void)
{
int m,n;
printf("Enter the values of m and n : ");
scanf("%d %d",&m,&n);
char** str = new char*[10000];
for (int i=0;i<10000;i++)
str[i] = new char[20];
int** x = new int*[10000];
for (int i=0;i<10000;i++)
x[i] = new int[20];
int **d_x;
char **d_str;
char **STR;
cudaMalloc(&d_x, m*n*sizeof(int));
cudaMalloc(&d_str, m*n*sizeof(char));
cudaMalloc(&STR, 10000*sizeof(char));
for (int i = 0; i < m; i++) {
for(int j = 0; j < n; j++ )
scanf("%d",x[i][j]]);
scanf("%c",str[i][j]]);
}
}
cudaMemcpy(d_x, x, m*n*sizeof(int),
cudaMemcpyHostToDevice);
cudaMemcpy(d_str, str, m*n*sizeof(char),
cudaMemcpyHostToDevice);
// Kernel for device
cuda_print<<<1,1>>>(m, n, d_x, d_str);
cudaFree(d_x);
cudaFree(d_str);
free(x);
free(str);
}
4A. Write a CUDA host program that reads a character type matrix A and integer type matrix B of size mxn. It produces an output string STR such that, every character of A is repeated n times (where n...