如何解决错误:"检测到时钟偏差"?

zin*_*rod 17 makefile clock

我将我的OpenCL和Cuda代码上传到hgpu.org,因为我的笔记本电脑上没有显卡.当我上传我的代码时,我收到以下错误:

make: Warning: File `main.cu' has modification time 381 s in the future
make: warning:  Clock skew detected.  Your build may be incomplete.
Run Code Online (Sandbox Code Playgroud)

我知道时钟偏差是由于我的机器时钟时间和服务器的时钟时间不同所以我将时间与服务器的时间同步.OpenCL和C++代码现在运行正常,但Cuda代码仍然给我这个错误.

所以我的问题是:

除了时间同步之外,还有其他原因造成时钟偏差吗?如果有,那我该如何解决呢?

Cuda代码:

__global__
void test()
{
}

int main()
{
    dim3 gridblock(1,1,1);
    dim3 threadblock(1,1,1);

    test<<<gridblock,threadblock>>>();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

注意:我也可以提供make文件.

Mun*_*qar 12

Type the following command:

find . -exec touch \{\} \;
Run Code Online (Sandbox Code Playgroud)

(the first argument(s) to find specify the directory(s) to search)

  • 注意详细说明? (17认同)

小智 7

原因之一可能是您的电脑的日期/时间不正确。

在 Ubuntu PC 中使用以下命令检查日期和时间:

date
Run Code Online (Sandbox Code Playgroud)

例如,更新日期和时间的方法之一是:

date -s "23 MAR 2017 17:06:00"
Run Code Online (Sandbox Code Playgroud)

  • 符合这种情况,修正系统时间,问题解决。:) (3认同)

chi*_*ies 5

看到这篇文章:在远程Linux机器上编译C++ - "检测到时钟偏差"警告.

我建议只复制源代码(没有可执行文件),然后运行touch *将最后修改的时间设置为当前的hgpu.org服务器时间.不幸的是,这将迫使一切都重建.

出于好奇,在同步PC时间之后,main.cu的修改时间仍然是381秒吗?


小智 5

只需转到问题文件所在的目录,touch *在控制台中键入不带引号的命令,您就可以了。

  • 并更新该目录中所有文件的时间戳?这不是很危险,特别是如果在错误的目录中意外完成的话吗? (2认同)

zin*_*rod 3

我要回答我自己的问题。

我将以下代码行添加到我的 Makefile 中,它修复了“时钟偏差”问题:

clean:  
    find . -type f | xargs touch
    rm -rf $(OBJS)
Run Code Online (Sandbox Code Playgroud)

  • 这只能治疗症状,而不是根本原因,它不能“解决”问题。如果其他人也有这个问题,请不要这样做! (19认同)
  • @RolKau 你认为问题是什么? (2认同)