Identifier "cudaDeviceSynchronize" is undefined in device code

I got my code running whith the errors like:
main_array.cu(404): error: calling a host function(“cudaDeviceSynchronize”) from a device function(“ParameterIdentifyCOA::cal_y”) is not allowed

main_array.cu(404): error: identifier “cudaDeviceSynchronize” is undefined in device code
but according to definition: __host__​__device__​[cudaError_t] cudaDeviceSynchronize ( void ), cudaDeviceSynchronize is host and device function
.
The CUDA version is CUDA 12.0 / Nvidia rtx 3090
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

The code runs normally under:
The CUDA version is CUDA 11.8/ Nvidia rtx 3080ti
g++ (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)

The system running is: CentOS7