Acces violation writing


I have the following error when trying to build my kernel.

Unhandled exception at 0x00732a83 in TTP-GPU.exe: 0xC0000005: Access violation writing location 0x00000000.

after commenting and decommenting several days I narrowed it down to this

	oldCost = newCost;

	for(int i = 0; (i < numbOfRounds); i++)
		schedule[i] = tempSched[i];

	nbf = (viol == 0) ? fmin(newCost, bestFeasible): nbf;
	nbi = (viol != 0) ? fmin(newCost, bestInfeasible): nbi;

	for(int i = 0; (i < numbOfRounds); i++){
		vstore8(schedule[i], (gID * numbOfRounds) + i, out);

	costResult[gID] = bestInfeasible;
	violations[gID] = viol;
	omega = (viol == 0) ? omega / 1.04: omega * 1.00;

	bestInfeasible = nbi;

this codeblock is inside a loop. When I run it once. No problem. But when the loop loops several time i get acces violation writing.

It has something to do with the float bestInfeasible. If i comment the line in red my code runs just fine. When i uncomment it, it crashes. However, if u comment the costResult[gID] = bestInfeasible. my schedule outputs fine. If i uncomment him it sets everything to null. I have no clue why i get write errors. Don’t have this problem on openCL CPU.

I’m working on nvidea.