Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comment #683

Closed
wants to merge 2 commits into from
Closed

comment #683

wants to merge 2 commits into from

Conversation

zchrissirhcz
Copy link
Contributor

@zchrissirhcz zchrissirhcz commented Dec 3, 2018

On PC, run examples, say squeezenet, and by default it will show this msg:

(My Visual Studio use Chinese)

用户错误 1001: num_threads 子句的参数必须是正值

(If Visual Studio in English)

Argument to num_threads clause must be positive

so I add this if statement to ensure number of threads >= 1

@coveralls
Copy link

Coverage Status

Coverage remained the same at ?% when pulling 5ced530 on zchrissirhcz:master into ed2a24c on Tencent:master.

@zchrissirhcz
Copy link
Contributor Author

@coveralls Can you try again plz?

@nihui
Copy link
Member

nihui commented Dec 3, 2018

the default value for num_threads shall be the cpu count, how does this situation happen

besides, the param sanity check shall be done in setter function
void Extractor::set_num_threads(int num_threads)

@zchrissirhcz
Copy link
Contributor Author

This error occurs on Visual Studio 2013(Win10). However, on Linux(Ubuntu16.04, gcc5.4.0) there is no this error.

@zchrissirhcz
Copy link
Contributor Author

zchrissirhcz commented Jan 9, 2019

@nihui 这个问题我在群里提出过,后来自行debug后提交了这一PR。今天又有群友遇到这个问题,他是用的20181228代码。按照我的PR中的修改20181228代码,Release模式下问题解决,Debug模式下仍然出现该问题。

这个问题在大神们看来肯定不算什么问题,我仅代表小白贴一下临时解决方案好了: 在每个extractor创建后,手动设定其线程数为大于等于1的数字,例如:

        ncnn::Extractor ex = squeezenet.create_extractor();  //原有代码
	ex.set_num_threads(1);   //需要添加的代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants