使用或不使用选项-g -G编译CUDA程序时有什么区别(What is the difference when compiling a CUDA program with or without option -g -G)
我有一个CUDA计划。 如果我使用-g -G选项编译该程序,我可以得到正确的输出。 如果我在没有-g -G选项的情况下编译它,我并不总是得到正确的输出。 我的猜测是,如果没有-g -G选项,编译器将优化程序并导致竞争条件。 任何人都可以确认这一点,也让我知道如果我没有-g -G选项编译程序,我该怎么做才能让程序产生正确的输出。 谢谢
操作系统:x86_64 GNU / Linux CUDA版本:4.0设备:Geforce 200,它是连接到机器的GPUS之一,我不认为它是显示设备。
I have a CUDA program. If I compile this program with -g -G option, I can get the correct output. If I compile it without -g -G option, I don't always get the correct output. My guess is that without -g -G option, the compiler will optimize the program and cause race condition. Can anyone confirm this, and also let me know what should I do to have the program produce the correct output even if I compile the program without -g -G option. Thanks
operating system: x86_64 GNU/Linux CUDA version: 4.0 Device: Geforce 200, It is one of the GPUS attached to the machine, and I don't think it is a display device.
原文:https://stackoverflow.com/questions/9167324
最满意答案
在您的定义中,
private _noop: () => {};
_noop
被输入为返回对象的函数。当您将其指定为
this._noop = () => { };
您尝试分配给_noop
函数的类型为() => void
。如果你想
_noop
是函数返回什么,那么输入为:private _noop: () => void;
In your definition
private _noop: () => {};
_noop
is typed as a function returning an object.When you assign it as
this._noop = () => { };
the function you are trying to assign to_noop
is of type() => void
.If you wanted
_noop
to be function returning nothing then type it as:private _noop: () => void;
相关问答
更多-
声明它是静态的,并添加另一个辅助方法: static void* basicgetscore(void * object){ return ((Scoreget *) object)->dobasicgetscore(); } void * dobasicgetscore() // new helper method { // do stuff here return NULL; } 用以下方法创建pthread: if (pthread_create(&t,NULL,basic ...
-
试试这个 @Injectable() export class ApiSearchEffects { @Effect() search$: Observable
= this.actions$ .ofType(query.ActionTypes.QUERYSERVER) .debounceTime(300) .map((action: query.QueryServerAction) => action.payload) .switchMap(pa ... -
编辑基于更新: 不完全确定,你想要实现的目标是:
{{data.role | async}} {{data.role | async}} ,但是如果你想使用异步管道根据特定角色过滤用户,那就是将users声明为像你一样的Observable。 当你想要过滤时,请使用你的switch语句(就像你一样): case 'role': this.users = this.getUserByRole(this.role); break; 在此方法中,您将返 ... -
这是由于TypeScript v2.6中添加了--strictFunctionTypes编译器标志的行为。 类型(e: CustomEvent) => void函数不再被认为是EventListener的有效实例,它接受Event参数,而不是CustomEvent 。 因此,解决它的一种方法是关闭--strictFunctionTypes 。 另一种方法是传入一个接受Event的函数,然后通过类型保护缩小到CustomEvent : function isCustomEvent(event: Event): ...
-
您错过了从您的功能返回,在您的组件中被视为void 。 getUsers(){ return this._http.get(this._getUrl) .map((response: Response) => { return response.json(); // add return statement }) } You have missed to return from your function which is considered as void in your ...
-
这个值是真的吗? 获得void类型值的唯一方法是调用void -returning函数: function f() { } let x = f(); 请注意,因为通过类型() => void的变量对非void -returning函数进行别名是合法的,所以以这种方式获得的void值实际上可能不是 undefined的值,因此是子类型关系。 For which values is this true? The only way to obtain a value of type void is to inv ...
-
在您的定义中, private _noop: () => {}; _noop被输入为返回对象的函数。 当您将其指定为this._noop = () => { }; 您尝试分配给_noop函数的类型为() => void 。 如果你想_noop是函数返回什么,那么输入为: private _noop: () => void; In your definition private _noop: () => {}; _noop is typed as a function returning an object ...
-
通过将函数的地址转换为不同的原型并通过结果指针调用函数来调用具有不兼容原型的函数是非法的: void *my_callback(void *arg) { ... } void (*broken)(void *) = (void (*)(void *)) my_callback; broken(some_arg); // incorrect, my_callback returns a `void *` 你可以做的是传递makecontext你自己的回调,它会调用thread_func并忽略它的返回值 ...
-
在向服务发送数据时,类型'void'不能分配给'any []'(Type 'void' is not assignable to type 'any[]' when sending data to service)[2022-07-08]
除了@jonrsharpe说这应该工作: import 'rxjs/add/operator/do'; public getGifs(searchValue:string) { return this.http.get(this.link + searchValue +'&api_key='+ this.ApiKey) .map((res:Response) => res.json().data) .do( data => this.results.next(data)) ... -
我会直接承认我很少在C中找到复合文字的需要,但你的语法肯定是有根据的。 如果我正确理解你的问题,那就是试图确定应用于复合文字的上述address-of运算符是否导致const与非const指针。 除非化合物本身是常量限定的,否则它是非常量的。 我没有方便的C99标准,但我能为此提出的最好的例子是以下方面的指导性示例: C11标准§6.5.2.5p11 可以通过以下结构指定只读复合文字: (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6} 再加上复合文 ...