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

default threads on #19368

Merged
merged 19 commits into from
Jul 6, 2022
Merged

default threads on #19368

merged 19 commits into from
Jul 6, 2022

Conversation

ringabout
Copy link
Member

No description provided.

@arnetheduck
Copy link
Contributor

ooh, nice :) I hope there's progress here, tried it back in #10781 and it was .. difficult.

@ringabout
Copy link
Member Author

tried it back in #10781 and it was .. difficult.

Quite so, I hope I can manage it eventually.

@ringabout ringabout force-pushed the default_threads branch 2 times, most recently from ac2818c to d2ca3f4 Compare January 12, 2022 09:33
testament/categories.nim Outdated Show resolved Hide resolved
@ringabout
Copy link
Member Author

ringabout commented Jan 13, 2022

CI failure is partialy caused by #19372

@SolitudeSF
Copy link
Contributor

in some cases enabling threads give up to 5% performance hit in singlethread applications. is this just accepted?

@ringabout
Copy link
Member Author

Hi, it was discussed here: nim-lang/RFCs#361 and listed as the roadmap for 2.0: nim-lang/RFCs#437

IMO, it can hurt the performance of single-threaded application, they can use threads:off to mitigate the affects.

@ringabout ringabout mentioned this pull request May 11, 2022
33 tasks
@ringabout
Copy link
Member Author

I have made PRs to nitter and nim-plotly => SciNim/nim-plotly#82 and zedeus/nitter#662

changelog.md Outdated Show resolved Hide resolved
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
@Araq Araq merged commit 430a179 into nim-lang:devel Jul 6, 2022
@dom96
Copy link
Contributor

dom96 commented Jul 6, 2022

Does --threads:on imply a new DLL dependency? I saw a new user having trouble with nimsuggest because of missing libwinpthread-1.dll: dom96/choosenim#298.

@cheatfate
Copy link
Member

cheatfate commented Jul 6, 2022

If std or choosenim uses one of this procedures on Windows

clock_getres
clock_gettime
clock_nanosleep
clock_settime
nanosleep
pthread_attr_destroy
pthread_attr_getdetachstate
pthread_attr_getinheritsched
pthread_attr_getschedparam
pthread_attr_getschedpolicy
pthread_attr_getscope
pthread_attr_getstack
pthread_attr_getstackaddr
pthread_attr_getstacksize
pthread_attr_init
pthread_attr_setdetachstate
pthread_attr_setinheritsched
pthread_attr_setschedparam
pthread_attr_setschedpolicy
pthread_attr_setscope
pthread_attr_setstack
pthread_attr_setstackaddr
pthread_attr_setstacksize
pthread_barrier_destroy
pthread_barrier_init
pthread_barrier_wait
pthread_barrierattr_destroy
pthread_barrierattr_getpshared
pthread_barrierattr_init
pthread_barrierattr_setpshared
pthread_cancel
pthread_cond_broadcast
pthread_cond_destroy
pthread_cond_init
pthread_cond_signal
pthread_cond_timedwait
pthread_cond_timedwait_relative_np
pthread_cond_wait
pthread_condattr_destroy
pthread_condattr_getclock
pthread_condattr_getpshared
pthread_condattr_init
pthread_condattr_setclock
pthread_condattr_setpshared
pthread_create
pthread_create_wrapper
pthread_delay_np
pthread_detach
pthread_equal
pthread_exit
pthread_get_concurrency
pthread_getclean
pthread_getconcurrency
pthread_getevent
pthread_gethandle
pthread_getname_np
pthread_getschedparam
pthread_getspecific
pthread_join
pthread_key_create
pthread_key_delete
pthread_kill
pthread_mutex_destroy
pthread_mutex_init
pthread_mutex_lock
pthread_mutex_timedlock
pthread_mutex_trylock
pthread_mutex_unlock
pthread_mutexattr_destroy
pthread_mutexattr_getprioceiling
pthread_mutexattr_getprotocol
pthread_mutexattr_getpshared
pthread_mutexattr_gettype
pthread_mutexattr_init
pthread_mutexattr_setprioceiling
pthread_mutexattr_setprotocol
pthread_mutexattr_setpshared
pthread_mutexattr_settype
pthread_num_processors_np
pthread_once
pthread_rwlock_destroy
pthread_rwlock_init
pthread_rwlock_rdlock
pthread_rwlock_timedrdlock
pthread_rwlock_timedwrlock
pthread_rwlock_tryrdlock
pthread_rwlock_trywrlock
pthread_rwlock_unlock
pthread_rwlock_wrlock
pthread_rwlockattr_destroy
pthread_rwlockattr_getpshared
pthread_rwlockattr_init
pthread_rwlockattr_setpshared
pthread_self
pthread_set_concurrency
pthread_set_num_processors_np
pthread_setcancelstate
pthread_setcanceltype
pthread_setconcurrency
pthread_setname_np
pthread_setschedparam
pthread_setspecific
pthread_spin_destroy
pthread_spin_init
pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_testcancel
pthread_timechange_handler_np
pthread_tls_init
sched_get_priority_max
sched_get_priority_min
sched_getscheduler
sched_setscheduler
sched_yield
sem_close
sem_destroy
sem_getvalue
sem_init
sem_open
sem_post
sem_post_multiple
sem_timedwait
sem_trywait
sem_unlink
sem_wait

It will require this DLL. But usually you should avoid usage of posix_ pthread_ functions on Windows.

@dom96
Copy link
Contributor

dom96 commented Jul 6, 2022

Does enabling --threads mean that one of those functions is used?

@dom96
Copy link
Contributor

dom96 commented Jul 6, 2022

Yep, it does. I compiled a simple hello world with and without --threads:on:

image

image

This means --threads:on on Windows adds an implicit DLL dependency. On my system this actually breaks this simple hello world example because it grabs an x86 libwinpthread from my Android SDK install.

@ghost
Copy link

ghost commented Jul 6, 2022

@dom96 to be fair this DLL is not added as a dependency if the C compiler uses native Windows threads like VCC or statically link winpthread like tdm-gcc

FedericoCeratto pushed a commit to FedericoCeratto/Nim that referenced this pull request Jul 30, 2022
* default threads on

* make rst gcsafe

* ignore threads option for nimscript

* threads off

* use createShared for threads

* test without threads

* avr threds off

* avr threads off

* async threads off

* threads off

* fix ci

* restore option

* make CI pleased

* fix ic tests

* Update config.nims

* add changelog

* Update changelog.md

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
* default threads on

* make rst gcsafe

* ignore threads option for nimscript

* threads off

* use createShared for threads

* test without threads

* avr threds off

* avr threads off

* async threads off

* threads off

* fix ci

* restore option

* make CI pleased

* fix ic tests

* Update config.nims

* add changelog

* Update changelog.md

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
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.

7 participants