#include <iostream> 
#include <cmath> 
#include <cassert> 

void checkError (cudaError_t err, int line) {
  if (err == cudaSuccess) return;
  std::cout << "Error code " << err << " : " << cudaGetErrorString(err) << " " << " on line " << line << ", aborting.\n";
  assert(false); 
}

#define CUDACALL(x) checkError(x, __LINE__)

__global__ void dev_calculate_Gaussians (double* data, double mean, double sigma) {
  // EXERCISE: Write this function so that each thread updates one
  // index of the array data. The output value should be the Gaussian
  // probability of the input value, given mean and sigma. 
  // (Optionally add a separate array for the output so that the input data
  // are not overwritten.) 
}

__global__ void dev_reduce_vector (double* data, double* result) {
  // EXERCISE: Write this function so it takes the sum of
  // the values in data and puts them into result. 
  // NB: You should assume that the size of data is smaller
  // than one block - you need not worry about synchronising
  // across blocks. 

}

int main (int argc, char** argv) {
  int sizeOfVector = atoi(argv[1]); 

  // EXERCISE: Check that the sizeOfVector variable
  // is small enough that the GPU is able to launch
  // that many threads in a single block. 




  double mean = 5;
  double sigma = 3; 

  // Generate a host-side vector and fill it with random numbers. 
  double* host_data = new double[sizeOfVector];
  for (int i = 0; i < sizeOfVector; ++i) {
    host_data[i] = (rand() % 11) - 5; 
  }

  // Host-side numbers to check against device-side ones. 
  double* host_probs = new double[sizeOfVector]; 
  double host_sum = 0; 
  for (int i = 0; i < sizeOfVector; ++i) {
    host_probs[i] = exp(-0.5 * pow((host_data[i] - mean) / sigma, 2));
    host_probs[i] /= (sigma * sqrt(2*M_PI)); 
    host_sum += host_probs[i]; 
  }

  double* dev_data = 0; 
  // EXERCISE: Create a device-side array with sizeOfVector elements and copy the host data into it.
  // EXERCISE: Launch a one-block kernel which will run the method dev_calculate_Gaussians
  //           on each element of dev_data. 
  // EXERCISE: Copy back the results of the calculation into host_data. 

  // Check for reasonableness
  double tolerance = 1e-6;  
  for (int i = 0; i < sizeOfVector; ++i) {
    if (fabs(host_data[i] - host_probs[i]) <= tolerance) continue;
    std::cout << "Problem with entry " << i << ": " 
	      << host_probs[i] << " " << host_data[i] << " "
	      << (host_probs[i] - host_data[i])  
	      << std::endl; 
  }

  std::cout << "Sum from CPU: " << host_sum << std::endl; 
  double* device_sum = 0; 
  // EXERCISE: Allocate a single double on the device, putting its address into device_sum. 
  // EXERCISE: Launch a kernel to sum the elements of dev_data and put the result in device_sum.
  // EXERCISE: Copy the result back into host_sum.

  std::cout << "Sum from GPU: " << host_sum << std::endl; 
  
  
  return 0; 
}

	.file	"tmpxft_002416b8_00000000-6_exercise1.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3639:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3639:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Error code "
.LC1:
	.string	" : "
.LC2:
	.string	" "
.LC3:
	.string	" on line "
.LC4:
	.string	", aborting.\n"
	.text
	.globl	_Z10checkError9cudaErrori
	.type	_Z10checkError9cudaErrori, @function
_Z10checkError9cudaErrori:
.LFB3635:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L2
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	leaq	.LC0(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edi, %ebx
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %r12
	call	cudaGetErrorString@PLT
	movq	%r12, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	popq	%rbx
	.cfi_restore 3
	.cfi_def_cfa_offset 24
	leaq	.LC4(%rip), %rsi
	popq	%rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 16
	movq	%rax, %rdi
	popq	%r12
	.cfi_restore 12
	.cfi_def_cfa_offset 8
	jmp	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L2:
	ret
	.cfi_endproc
.LFE3635:
	.size	_Z10checkError9cudaErrori, .-_Z10checkError9cudaErrori
	.section	.rodata.str1.1
.LC12:
	.string	"Problem with entry "
.LC13:
	.string	": "
.LC14:
	.string	"Sum from CPU: "
.LC15:
	.string	"Sum from GPU: "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	8(%rsi), %rdi
	call	atoi@PLT
	movslq	%eax, %r12
	movabsq	$1152921504606846975, %rax
	cmpq	%r12, %rax
	jb	.L9
	movq	%r12, %rbx
	salq	$3, %r12
	xorl	%r13d, %r13d
	movl	$11, %r14d
	movq	%r12, %rdi
	call	_Znam@PLT
	movq	%rax, %rbp
	jmp	.L10
.L9:
	call	__cxa_throw_bad_array_new_length@PLT
.L10:
	cmpl	%r13d, %ebx
	jle	.L18
	call	rand@PLT
	cltd
	idivl	%r14d
	subl	$5, %edx
	cvtsi2sdl	%edx, %xmm0
	movsd	%xmm0, 0(%rbp,%r13,8)
	incq	%r13
	jmp	.L10
.L18:
	movq	%r12, %rdi
	xorl	%r13d, %r13d
	call	_Znam@PLT
	movq	$0x000000000, 8(%rsp)
	movq	%rax, %r12
.L12:
	cmpl	%r13d, %ebx
	jle	.L19
	movsd	0(%rbp,%r13,8), %xmm0
	subsd	.LC6(%rip), %xmm0
	divsd	.LC7(%rip), %xmm0
	mulsd	%xmm0, %xmm0
	mulsd	.LC8(%rip), %xmm0
	call	exp@PLT
	divsd	.LC9(%rip), %xmm0
	movsd	%xmm0, (%r12,%r13,8)
	incq	%r13
	addsd	8(%rsp), %xmm0
	movsd	%xmm0, 8(%rsp)
	jmp	.L12
.L19:
	xorl	%r13d, %r13d
.L14:
	cmpl	%r13d, %ebx
	jle	.L20
	movsd	0(%rbp,%r13,8), %xmm3
	movsd	(%r12,%r13,8), %xmm4
	movsd	.LC11(%rip), %xmm1
	movaps	%xmm3, %xmm0
	movsd	%xmm3, 16(%rsp)
	subsd	%xmm4, %xmm0
	andps	.LC10(%rip), %xmm0
	movsd	%xmm4, 24(%rsp)
	comisd	%xmm0, %xmm1
	jnb	.L15
	leaq	.LC12(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r13d, %esi
	leaq	.LC2(%rip), %r14
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC13(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	24(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	24(%rsp), %xmm0
	subsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.L15:
	incq	%r13
	jmp	.L14
.L20:
	leaq	_ZSt4cout(%rip), %rbx
	leaq	.LC14(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	leaq	.LC15(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3636:
	.size	main, .-main
	.text
	.globl	_Z45__device_stub__Z23dev_calculate_GaussiansPdddPddd
	.type	_Z45__device_stub__Z23dev_calculate_GaussiansPdddPddd, @function
_Z45__device_stub__Z23dev_calculate_GaussiansPdddPddd:
.LFB3661:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	32(%rsp), %rdx
	movsd	%xmm0, 16(%rsp)
	leaq	60(%rsp), %rsi
	leaq	48(%rsp), %rdi
	movsd	%xmm1, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L21
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z23dev_calculate_GaussiansPddd(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L21:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3661:
	.size	_Z45__device_stub__Z23dev_calculate_GaussiansPdddPddd, .-_Z45__device_stub__Z23dev_calculate_GaussiansPdddPddd
	.globl	_Z23dev_calculate_GaussiansPddd
	.type	_Z23dev_calculate_GaussiansPddd, @function
_Z23dev_calculate_GaussiansPddd:
.LFB3662:
	.cfi_startproc
	endbr64
	jmp	_Z45__device_stub__Z23dev_calculate_GaussiansPdddPddd
	.cfi_endproc
.LFE3662:
	.size	_Z23dev_calculate_GaussiansPddd, .-_Z23dev_calculate_GaussiansPddd
	.globl	_Z39__device_stub__Z17dev_reduce_vectorPdS_PdS_
	.type	_Z39__device_stub__Z17dev_reduce_vectorPdS_PdS_, @function
_Z39__device_stub__Z17dev_reduce_vectorPdS_PdS_:
.LFB3663:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L26
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z17dev_reduce_vectorPdS_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L26:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3663:
	.size	_Z39__device_stub__Z17dev_reduce_vectorPdS_PdS_, .-_Z39__device_stub__Z17dev_reduce_vectorPdS_PdS_
	.globl	_Z17dev_reduce_vectorPdS_
	.type	_Z17dev_reduce_vectorPdS_, @function
_Z17dev_reduce_vectorPdS_:
.LFB3664:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z17dev_reduce_vectorPdS_PdS_
	.cfi_endproc
.LFE3664:
	.size	_Z17dev_reduce_vectorPdS_, .-_Z17dev_reduce_vectorPdS_
	.section	.rodata.str1.1
.LC16:
	.string	"_Z17dev_reduce_vectorPdS_"
.LC17:
	.string	"_Z23dev_calculate_GaussiansPddd"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3666:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC16(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z17dev_reduce_vectorPdS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC17(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z23dev_calculate_GaussiansPddd(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3666:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC6:
	.long	0
	.long	1075052544
	.align 8
.LC7:
	.long	0
	.long	1074266112
	.align 8
.LC8:
	.long	0
	.long	-1075838976
	.align 8
.LC9:
	.long	-1343145336
	.long	1075713116
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC10:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC11:
	.long	-1598689907
	.long	1051772663
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream> 
#include <cmath> 
#include <cassert> 

void checkError (hipError_t err, int line) {
  if (err == hipSuccess) return;
  std::cout << "Error code " << err << " : " << hipGetErrorString(err) << " " << " on line " << line << ", aborting.\n";
  assert(false); 
}

#define CUDACALL(x) checkError(x, __LINE__)

__global__ void dev_calculate_Gaussians (double* data, double mean, double sigma) {
  // EXERCISE: Write this function so that each thread updates one
  // index of the array data. The output value should be the Gaussian
  // probability of the input value, given mean and sigma. 
  // (Optionally add a separate array for the output so that the input data
  // are not overwritten.) 
}

__global__ void dev_reduce_vector (double* data, double* result) {
  // EXERCISE: Write this function so it takes the sum of
  // the values in data and puts them into result. 
  // NB: You should assume that the size of data is smaller
  // than one block - you need not worry about synchronising
  // across blocks. 

}

int main (int argc, char** argv) {
  int sizeOfVector = atoi(argv[1]); 

  // EXERCISE: Check that the sizeOfVector variable
  // is small enough that the GPU is able to launch
  // that many threads in a single block. 




  double mean = 5;
  double sigma = 3; 

  // Generate a host-side vector and fill it with random numbers. 
  double* host_data = new double[sizeOfVector];
  for (int i = 0; i < sizeOfVector; ++i) {
    host_data[i] = (rand() % 11) - 5; 
  }

  // Host-side numbers to check against device-side ones. 
  double* host_probs = new double[sizeOfVector]; 
  double host_sum = 0; 
  for (int i = 0; i < sizeOfVector; ++i) {
    host_probs[i] = exp(-0.5 * pow((host_data[i] - mean) / sigma, 2));
    host_probs[i] /= (sigma * sqrt(2*M_PI)); 
    host_sum += host_probs[i]; 
  }

  double* dev_data = 0; 
  // EXERCISE: Create a device-side array with sizeOfVector elements and copy the host data into it.
  // EXERCISE: Launch a one-block kernel which will run the method dev_calculate_Gaussians
  //           on each element of dev_data. 
  // EXERCISE: Copy back the results of the calculation into host_data. 

  // Check for reasonableness
  double tolerance = 1e-6;  
  for (int i = 0; i < sizeOfVector; ++i) {
    if (fabs(host_data[i] - host_probs[i]) <= tolerance) continue;
    std::cout << "Problem with entry " << i << ": " 
	      << host_probs[i] << " " << host_data[i] << " "
	      << (host_probs[i] - host_data[i])  
	      << std::endl; 
  }

  std::cout << "Sum from CPU: " << host_sum << std::endl; 
  double* device_sum = 0; 
  // EXERCISE: Allocate a single double on the device, putting its address into device_sum. 
  // EXERCISE: Launch a kernel to sum the elements of dev_data and put the result in device_sum.
  // EXERCISE: Copy the result back into host_sum.

  std::cout << "Sum from GPU: " << host_sum << std::endl; 
  
  
  return 0; 
}

	.text
	.file	"exercise1.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z10checkError10hipError_ti     # -- Begin function _Z10checkError10hipError_ti
	.type	_Z10checkError10hipError_ti,@function
_Z10checkError10hipError_ti:            # @_Z10checkError10hipError_ti
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	je	.LBB0_5
# %bb.1:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebx
	movl	%edi, %ebp
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$11, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%ebp, %esi
	callq	_ZNSolsEi
	movq	%rax, %r14
	movl	$.L.str.1, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB0_2
# %bb.3:
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	strlen
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB0_4
.LBB0_5:
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %rbp
	.cfi_restore %r14
	.cfi_restore %r15
	retq
.LBB0_2:
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %rbp, -16
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%r14), %rax
	movq	-24(%rax), %rax
	movq	%r14, %rdi
	addq	%rax, %rdi
	movl	32(%r14,%rax), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB0_4:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movl	$.L.str.2, %esi
	movl	$1, %edx
	movq	%r14, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$.L.str.3, %esi
	movl	$9, %edx
	movq	%r14, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_ZNSolsEi
	movl	$.L.str.4, %esi
	movl	$12, %edx
	movq	%rax, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l # TAILCALL
.Lfunc_end0:
	.size	_Z10checkError10hipError_ti, .Lfunc_end0-_Z10checkError10hipError_ti
	.cfi_endproc
                                        # -- End function
	.globl	_Z38__device_stub__dev_calculate_GaussiansPddd # -- Begin function _Z38__device_stub__dev_calculate_GaussiansPddd
	.type	_Z38__device_stub__dev_calculate_GaussiansPddd,@function
_Z38__device_stub__dev_calculate_GaussiansPddd: # @_Z38__device_stub__dev_calculate_GaussiansPddd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movsd	%xmm0, (%rcx)
	leaq	24(%rsp), %rdx
	movsd	%xmm1, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdx, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z23dev_calculate_GaussiansPddd, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z38__device_stub__dev_calculate_GaussiansPddd, .Lfunc_end1-_Z38__device_stub__dev_calculate_GaussiansPddd
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__dev_reduce_vectorPdS_ # -- Begin function _Z32__device_stub__dev_reduce_vectorPdS_
	.type	_Z32__device_stub__dev_reduce_vectorPdS_,@function
_Z32__device_stub__dev_reduce_vectorPdS_: # @_Z32__device_stub__dev_reduce_vectorPdS_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17dev_reduce_vectorPdS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z32__device_stub__dev_reduce_vectorPdS_, .Lfunc_end2-_Z32__device_stub__dev_reduce_vectorPdS_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI3_0:
	.quad	0xc014000000000000              # double -5
.LCPI3_1:
	.quad	0x4008000000000000              # double 3
.LCPI3_2:
	.quad	0xbfe0000000000000              # double -0.5
.LCPI3_3:
	.quad	0x401e145caff13a88              # double 7.5198848238930011
.LCPI3_5:
	.quad	0x3eb0c6f7a0b5ed8d              # double 9.9999999999999995E-7
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI3_4:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	8(%rsi), %rdi
	callq	atoi
	movl	%eax, %ebp
	movslq	%eax, %r15
	leaq	(,%r15,8), %rax
	testl	%r15d, %r15d
	movq	$-1, %r14
	cmovnsq	%rax, %r14
	movq	%r14, %rdi
	callq	_Znam
	xorpd	%xmm0, %xmm0
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	testl	%r15d, %r15d
	jle	.LBB3_11
# %bb.1:                                # %.lr.ph.preheader
	movq	%rax, %rbx
	movl	%ebp, %r13d
	xorl	%r15d, %r15d
.LBB3_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	cltq
	imulq	$780903145, %rax, %rcx          # imm = 0x2E8BA2E9
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$33, %rcx
	addl	%edx, %ecx
	leal	(%rcx,%rcx,4), %edx
	leal	(%rcx,%rdx,2), %ecx
	negl	%ecx
	addl	%ecx, %eax
	addl	$-5, %eax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	movsd	%xmm0, (%rbx,%r15,8)
	incq	%r15
	cmpq	%r15, %r13
	jne	.LBB3_2
# %bb.3:                                # %._crit_edge
	movq	%r14, %rdi
	callq	_Znam
	testl	%ebp, %ebp
	jle	.LBB3_11
# %bb.4:                                # %.lr.ph49.preheader
	movq	%rax, %r14
	xorpd	%xmm0, %xmm0
	xorl	%r15d, %r15d
.LBB3_5:                                # %.lr.ph49
                                        # =>This Inner Loop Header: Depth=1
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	movsd	(%rbx,%r15,8), %xmm0            # xmm0 = mem[0],zero
	addsd	.LCPI3_0(%rip), %xmm0
	divsd	.LCPI3_1(%rip), %xmm0
	mulsd	%xmm0, %xmm0
	mulsd	.LCPI3_2(%rip), %xmm0
	callq	exp
	divsd	.LCPI3_3(%rip), %xmm0
	movsd	%xmm0, (%r14,%r15,8)
	movsd	(%rsp), %xmm1                   # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	%xmm0, %xmm1
	movsd	%xmm1, (%rsp)                   # 8-byte Spill
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	incq	%r15
	cmpq	%r15, %r13
	jne	.LBB3_5
# %bb.6:                                # %.preheader
	testl	%ebp, %ebp
	jle	.LBB3_11
# %bb.7:                                # %.lr.ph51.preheader
	xorl	%r15d, %r15d
	movapd	.LCPI3_4(%rip), %xmm1           # xmm1 = [NaN,NaN]
	movsd	.LCPI3_5(%rip), %xmm2           # xmm2 = mem[0],zero
.LBB3_8:                                # %.lr.ph51
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rbx,%r15,8), %xmm4            # xmm4 = mem[0],zero
	movsd	(%r14,%r15,8), %xmm3            # xmm3 = mem[0],zero
	movapd	%xmm4, %xmm0
	subsd	%xmm3, %xmm0
	andpd	%xmm1, %xmm0
	ucomisd	%xmm0, %xmm2
	jae	.LBB3_10
# %bb.9:                                #   in Loop: Header=BB3_8 Depth=1
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$19, %edx
	movsd	%xmm3, 8(%rsp)                  # 8-byte Spill
	movsd	%xmm4, 16(%rsp)                 # 8-byte Spill
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%r15d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r12
	movl	$.L.str.6, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r12, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movl	$.L.str.2, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r12, %rdi
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movl	$.L.str.2, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	subsd	16(%rsp), %xmm0                 # 8-byte Folded Reload
	movq	%r12, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movsd	.LCPI3_5(%rip), %xmm2           # xmm2 = mem[0],zero
	movapd	.LCPI3_4(%rip), %xmm1           # xmm1 = [NaN,NaN]
.LBB3_10:                               #   in Loop: Header=BB3_8 Depth=1
	incq	%r15
	cmpq	%r15, %r13
	jne	.LBB3_8
.LBB3_11:                               # %._crit_edge52
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$14, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.8, %esi
	movl	$14, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z23dev_calculate_GaussiansPddd, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17dev_reduce_vectorPdS_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB5_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Error code "
	.size	.L.str, 12

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	" : "
	.size	.L.str.1, 4

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	" "
	.size	.L.str.2, 2

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	" on line "
	.size	.L.str.3, 10

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	", aborting.\n"
	.size	.L.str.4, 13

	.type	_Z23dev_calculate_GaussiansPddd,@object # @_Z23dev_calculate_GaussiansPddd
	.section	.rodata,"a",@progbits
	.globl	_Z23dev_calculate_GaussiansPddd
	.p2align	3, 0x0
_Z23dev_calculate_GaussiansPddd:
	.quad	_Z38__device_stub__dev_calculate_GaussiansPddd
	.size	_Z23dev_calculate_GaussiansPddd, 8

	.type	_Z17dev_reduce_vectorPdS_,@object # @_Z17dev_reduce_vectorPdS_
	.globl	_Z17dev_reduce_vectorPdS_
	.p2align	3, 0x0
_Z17dev_reduce_vectorPdS_:
	.quad	_Z32__device_stub__dev_reduce_vectorPdS_
	.size	_Z17dev_reduce_vectorPdS_, 8

	.type	.L.str.5,@object                # @.str.5
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.5:
	.asciz	"Problem with entry "
	.size	.L.str.5, 20

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	": "
	.size	.L.str.6, 3

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Sum from CPU: "
	.size	.L.str.7, 15

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Sum from GPU: "
	.size	.L.str.8, 15

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z23dev_calculate_GaussiansPddd"
	.size	.L__unnamed_1, 32

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z17dev_reduce_vectorPdS_"
	.size	.L__unnamed_2, 26

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z38__device_stub__dev_calculate_GaussiansPddd
	.addrsig_sym _Z32__device_stub__dev_reduce_vectorPdS_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z23dev_calculate_GaussiansPddd
	.addrsig_sym _Z17dev_reduce_vectorPdS_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z23dev_calculate_GaussiansPddd ; -- Begin function _Z23dev_calculate_GaussiansPddd
	.globl	_Z23dev_calculate_GaussiansPddd
	.p2align	8
	.type	_Z23dev_calculate_GaussiansPddd,@function
_Z23dev_calculate_GaussiansPddd:        ; @_Z23dev_calculate_GaussiansPddd
; %bb.0:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z23dev_calculate_GaussiansPddd
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 24
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 1
		.amdhsa_next_free_sgpr 1
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z23dev_calculate_GaussiansPddd, .Lfunc_end0-_Z23dev_calculate_GaussiansPddd
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 4
; NumSgprs: 0
; NumVgprs: 0
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 1
; NumVGPRsForWavesPerEU: 1
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z17dev_reduce_vectorPdS_ ; -- Begin function _Z17dev_reduce_vectorPdS_
	.globl	_Z17dev_reduce_vectorPdS_
	.p2align	8
	.type	_Z17dev_reduce_vectorPdS_,@function
_Z17dev_reduce_vectorPdS_:              ; @_Z17dev_reduce_vectorPdS_
; %bb.0:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17dev_reduce_vectorPdS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 16
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 1
		.amdhsa_next_free_sgpr 1
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z17dev_reduce_vectorPdS_, .Lfunc_end1-_Z17dev_reduce_vectorPdS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 4
; NumSgprs: 0
; NumVgprs: 0
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 1
; NumVGPRsForWavesPerEU: 1
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           8
        .value_kind:     by_value
      - .offset:         16
        .size:           8
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 24
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z23dev_calculate_GaussiansPddd
    .private_segment_fixed_size: 0
    .sgpr_count:     0
    .sgpr_spill_count: 0
    .symbol:         _Z23dev_calculate_GaussiansPddd.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     0
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 16
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17dev_reduce_vectorPdS_
    .private_segment_fixed_size: 0
    .sgpr_count:     0
    .sgpr_spill_count: 0
    .symbol:         _Z17dev_reduce_vectorPdS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     0
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
