atomicCAS undefined

I’ve tried to search for solutions online but most are regarding using an older architecture that isn’t supported like before SM_20 if I understand correctly.

uint rx = u;
uint ry = v;

uint prx = p[rx];
uint pry = p[ry];

while (prx != pry) {
	if (prx > pry) {
		uint tmp = prx;
		prx = pry;
		pry = tmp;
		tmp = rx;
		rx = ry;
		ry = tmp;
	}

uint result = atomicCAS(&p[ry], pry, prx);

However I’m being informed <identifier “atomicCAS” is not defined> , under error list I also receive the same error. The build sometimes complete, so my algorithm is capable of reading in the graph, but not doing the CAS. My friend also installed VS and tested but got the same error, I’m unsure what can cause this.

Are you specifically compiling with compute_35,sm_35 or higher ?
atomicCAS is not defined before those capabilities. (for example, compute_20,sm_20 wouldn’t work)

“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe” -gencode=arch=compute_61,code=“sm_61,compute_61” -gencode=arch=compute_35,code=“sm_35,compute_35” --use-local-env -ccbin

This is what I get when doing a build. The output lists:
E0020 identifier “atomicCAS” is undefined