Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Dijkstra probably hates me (Linus Torvalds, in kernel/sched.c)


devel / comp.lang.c++ / Relacy Rocks...

SubjectAuthor
* Relacy Rocks...Chris M. Thomasson
+- Re: Relacy Rocks...Chris M. Thomasson
+- Re: Relacy Rocks...Chris M. Thomasson
+- Re: Relacy Rocks...Chris M. Thomasson
+- Re: Relacy Rocks...Chris M. Thomasson
`- Re: Relacy Rocks...Chris M. Thomasson

1
Relacy Rocks...

<uii4a8$23ub9$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2572&group=comp.lang.c%2B%2B#2572

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Relacy Rocks...
Date: Thu, 9 Nov 2023 00:12:56 -0800
Organization: A noiseless patient Spider
Lines: 130
Message-ID: <uii4a8$23ub9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 08:12:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2226537"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NJ8Shax8hOsW3j2/LgE/fCToVun7c6Lc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TpGw+nJAi+oaU1aS/3xRxu3ViZo=
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 9 Nov 2023 08:12 UTC

Fwiw, I needed to get back into Relacy. Wrt Bonita, here is a Relacy
test unit for an old acquaintance of mine, Alex from over on
comp.programming.threads many years ago. A test of one of his fast
mutexes for windows, the code is used in:

Take notice that Relacy can model windows sync primitives, and C++...

rl::rl_HANDLE, rl_CreateEvent, ect, and such... ;^)

https://github.com/dvyukov/relacy

Just a quick test of Alex's original code:
______________________________________
#include <iostream>
#include <relacy/relacy.hpp>

#define CT_THREAD_N 3

// Testing Alex's mutex work from over on
// comp.programming.threads wrt windows...
// its on https://sourceware.org/pthreads-win32/
// anyway....

struct ct_alex_mutex_test_windows
{ rl::rl_HANDLE m_waitset;
rl::atomic<unsigned long> m_state;

ct_alex_mutex_test_windows()
: m_waitset(rl_CreateEvent(nullptr, false, false, nullptr)),
m_state(0)
{
if (! m_waitset) throw;
}

~ct_alex_mutex_test_windows()
{
CloseHandle(m_waitset);
}

void lock()
{
if (m_state.exchange(1, rl::mo_relaxed, $))
{
while (m_state.exchange(2, rl::mo_relaxed, $))
{
rl_WaitForSingleObject(m_waitset, INFINITE, $);
}
}

rl::atomic_thread_fence(rl::mo_acquire, $);
}

void unlock()
{
rl::atomic_thread_fence(rl::mo_release, $);

if (m_state.exchange(0, rl::mo_relaxed, $) == 2)
{
rl_SetEvent(m_waitset, $);
}
}
};

struct ct_relacy_test_fun : rl::test_suite<ct_relacy_test_fun, CT_THREAD_N>
{ VAR_T(unsigned long) m_test_0;
ct_alex_mutex_test_windows m_mutex;

void before()
{
VAR(m_test_0) = 0;

//std::cout << "ct_relacy_test_fun::before()" << std::endl;
}

void after()
{
// std::cout << "ct_relacy_test_fun::after()" << std::endl;

RL_ASSERT(VAR(m_test_0) == CT_THREAD_N);
}

void thread(unsigned int tidx)
{
m_mutex.lock();
VAR(m_test_0) += 1;
m_mutex.unlock();
}
};

int
main()
{ std::cout << "Relacy Testing 123... ;^)" << std::endl;

{
rl::test_params p;

//p.iteration_count = 10000000;
//p.execution_depth_limit = 33333;
//p.search_type = rl::sched_bound;
p.search_type = rl::fair_full_search_scheduler_type;
//p.search_type = rl::fair_context_bound_scheduler_type;

rl::simulate<ct_relacy_test_fun>(p);
}

return 0;
} ______________________________________

My output:
______________________________________
Relacy Testing 123... ;^)
struct ct_relacy_test_fun
5% (65536/1129586)
iterations: 90732
total time: 1609
throughput: 56390
______________________________________

Nice! Working like a charm. Now I can get into playing around with my
new'ish queue algorithm. I basically need to distribute it.

Re: Relacy Rocks...

<uii4gm$240cn$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2573&group=comp.lang.c%2B%2B#2573

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Relacy Rocks...
Date: Thu, 9 Nov 2023 00:16:22 -0800
Organization: A noiseless patient Spider
Lines: 126
Message-ID: <uii4gm$240cn$1@dont-email.me>
References: <uii4a8$23ub9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 9 Nov 2023 08:16:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2228631"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NjtA4khhOasnZGn+gpk9DOPZhPzqgjj4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:pnD9zUy/fIaLhMsl+dKOY4i8Ufg=
Content-Language: en-US
In-Reply-To: <uii4a8$23ub9$1@dont-email.me>
 by: Chris M. Thomasson - Thu, 9 Nov 2023 08:16 UTC

On 11/9/2023 12:12 AM, Chris M. Thomasson wrote:
> #include <iostream>
> #include <relacy/relacy.hpp>
>
>
> #define CT_THREAD_N 3
>
>
> // Testing Alex's mutex work from over on
> // comp.programming.threads wrt windows...
> // its on https://sourceware.org/pthreads-win32/
> // anyway....
>
> struct ct_alex_mutex_test_windows
> {
> [...]
>     void lock()
>     {
>         if (m_state.exchange(1, rl::mo_relaxed, $))
>         {
>             while (m_state.exchange(2, rl::mo_relaxed, $))
>             {
>                 rl_WaitForSingleObject(m_waitset, INFINITE, $);
>             }
>         }
>

>         rl::atomic_thread_fence(rl::mo_acquire, $);
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     }
[...]

Relacy kicks some ass. If I comment out that acquire thread fence:

rl::atomic_thread_fence(rl::mo_acquire, $);

Relacy knows things are really wrong here, and gives me the following
output:

Nice!
_______________________________
Relacy Testing 123... ;^)
struct ct_relacy_test_fun
DATA RACE (data race detected)
iteration: 1

execution history (16):
[0] 0: [CTOR BEGIN], in rl::context_impl<struct ct_relacy_test_fun,class
rl::full_search_scheduler<3> >::fiber_proc_impl, context.hpp(457)
[1] 0: memory allocation: addr=0000022E2E825B60, size=24, in
ct_alex_mutex_test_windows::ct_alex_mutex_test_windows, ct_main.cpp(19)
[2] 0: <0000022E2E81C890> atomic store, value=0, (prev value=0),
order=relaxed, in rl::atomic<unsigned long>::atomic, atomic.hpp(594)
[3] 0: [CTOR END], in rl::context_impl<struct ct_relacy_test_fun,class
rl::full_search_scheduler<3> >::fiber_proc_impl, context.hpp(457)
[4] 0: [BEFORE BEGIN], in rl::context_impl<struct
ct_relacy_test_fun,class rl::full_search_scheduler<3>
>::fiber_proc_impl, context.hpp(457)
[5] 0: <0000022E2E81C870> store, value=0, in ct_relacy_test_fun::before,
ct_main.cpp(63)
[6] 0: [BEFORE END], in rl::context_impl<struct ct_relacy_test_fun,class
rl::full_search_scheduler<3> >::fiber_proc_impl, context.hpp(457)
[7] 0: <0000022E2E81C890> exchange , prev=0, arg=1, new=1,
order=relaxed, in ct_alex_mutex_test_windows::lock, ct_main.cpp(32)
[8] 0: <0000022E2E81C870> load, value=0, in ct_relacy_test_fun::thread,
ct_main.cpp(78)
[9] 0: <0000022E2E81C870> store, value=1, in ct_relacy_test_fun::thread,
ct_main.cpp(78)
[10] 0: release fence, in ct_alex_mutex_test_windows::unlock,
ct_main.cpp(45)
[11] 0: <0000022E2E81C890> exchange , prev=1, arg=0, new=0,
order=relaxed, in ct_alex_mutex_test_windows::unlock, ct_main.cpp(47)
[12] 0: [THREAD FINISHED], in rl::context_impl<struct
ct_relacy_test_fun,class rl::full_search_scheduler<3>
>::fiber_proc_impl, context.hpp(457)
[13] 1: <0000022E2E81C890> exchange , prev=0, arg=1, new=1,
order=relaxed, in ct_alex_mutex_test_windows::lock, ct_main.cpp(32)
[14] 1: <0000022E2E81C870> load, value=0, in ct_relacy_test_fun::thread,
ct_main.cpp(78)
[15] 1: DATA RACE (data race detected), in ct_relacy_test_fun::thread,
ct_main.cpp(78)

thread 0:
[0] 0: [CTOR BEGIN], in rl::context_impl<struct ct_relacy_test_fun,class
rl::full_search_scheduler<3> >::fiber_proc_impl, context.hpp(457)
[1] 0: memory allocation: addr=0000022E2E825B60, size=24, in
ct_alex_mutex_test_windows::ct_alex_mutex_test_windows, ct_main.cpp(19)
[2] 0: <0000022E2E81C890> atomic store, value=0, (prev value=0),
order=relaxed, in rl::atomic<unsigned long>::atomic, atomic.hpp(594)
[3] 0: [CTOR END], in rl::context_impl<struct ct_relacy_test_fun,class
rl::full_search_scheduler<3> >::fiber_proc_impl, context.hpp(457)
[4] 0: [BEFORE BEGIN], in rl::context_impl<struct
ct_relacy_test_fun,class rl::full_search_scheduler<3>
>::fiber_proc_impl, context.hpp(457)
[5] 0: <0000022E2E81C870> store, value=0, in ct_relacy_test_fun::before,
ct_main.cpp(63)
[6] 0: [BEFORE END], in rl::context_impl<struct ct_relacy_test_fun,class
rl::full_search_scheduler<3> >::fiber_proc_impl, context.hpp(457)
[7] 0: <0000022E2E81C890> exchange , prev=0, arg=1, new=1,
order=relaxed, in ct_alex_mutex_test_windows::lock, ct_main.cpp(32)
[8] 0: <0000022E2E81C870> load, value=0, in ct_relacy_test_fun::thread,
ct_main.cpp(78)
[9] 0: <0000022E2E81C870> store, value=1, in ct_relacy_test_fun::thread,
ct_main.cpp(78)
[10] 0: release fence, in ct_alex_mutex_test_windows::unlock,
ct_main.cpp(45)
[11] 0: <0000022E2E81C890> exchange , prev=1, arg=0, new=0,
order=relaxed, in ct_alex_mutex_test_windows::unlock, ct_main.cpp(47)
[12] 0: [THREAD FINISHED], in rl::context_impl<struct
ct_relacy_test_fun,class rl::full_search_scheduler<3>
>::fiber_proc_impl, context.hpp(457)

thread 1:
[13] 1: <0000022E2E81C890> exchange , prev=0, arg=1, new=1,
order=relaxed, in ct_alex_mutex_test_windows::lock, ct_main.cpp(32)
[14] 1: <0000022E2E81C870> load, value=0, in ct_relacy_test_fun::thread,
ct_main.cpp(78)
[15] 1: DATA RACE (data race detected), in ct_relacy_test_fun::thread,
ct_main.cpp(78)

thread 2:
_______________________________

Pretty good!

:^D

Re: Relacy Rocks...

<uii4jl$240cn$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2574&group=comp.lang.c%2B%2B#2574

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Relacy Rocks...
Date: Thu, 9 Nov 2023 00:17:57 -0800
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <uii4jl$240cn$2@dont-email.me>
References: <uii4a8$23ub9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 08:17:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2228631"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1UoA5Pee9kpclnhOKctP7kI0e8m9UUvI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ljxE3BkJYM/eF1SE4dlbb4HZqU8=
Content-Language: en-US
In-Reply-To: <uii4a8$23ub9$1@dont-email.me>
 by: Chris M. Thomasson - Thu, 9 Nov 2023 08:17 UTC

On 11/9/2023 12:12 AM, Chris M. Thomasson wrote:
> Fwiw, I needed to get back into Relacy. Wrt Bonita, here is a Relacy
> test unit for an old acquaintance of mine, Alex from over on
> comp.programming.threads many years ago. A test of one of his fast
> mutexes for windows, the code is used in:
[...]

https://sourceware.org/pthreads-win32/

Re: Relacy Rocks...

<uii71p$24dtg$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2575&group=comp.lang.c%2B%2B#2575

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!gandalf.srv.welterde.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Relacy Rocks...
Date: Thu, 9 Nov 2023 00:59:37 -0800
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <uii71p$24dtg$1@dont-email.me>
References: <uii4a8$23ub9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 08:59:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2242480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/c6k/oqosfzzuH8fMKRY98DNPnYim2xz8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:cUZRckZJD3AAR2oEukbOaybiTjk=
Content-Language: en-US
In-Reply-To: <uii4a8$23ub9$1@dont-email.me>
 by: Chris M. Thomasson - Thu, 9 Nov 2023 08:59 UTC

On 11/9/2023 12:12 AM, Chris M. Thomasson wrote:
> Fwiw, I needed to get back into Relacy. Wrt Bonita, here is a Relacy
> test unit for an old acquaintance of mine, Alex from over on
> comp.programming.threads many years ago. A test of one of his fast
> mutexes for windows, the code is used in:
>
> Take notice that Relacy can model windows sync primitives, and C++...
>
> rl::rl_HANDLE, rl_CreateEvent, ect, and such... ;^)
>
>
> https://github.com/dvyukov/relacy
>
> Just a quick test of Alex's original code:
[...]

Some music that reminds of Relacy processing a long test:

https://youtu.be/QQ77ejz6i4M

Re: Relacy Rocks...

<uim4mi$30nss$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2585&group=comp.lang.c%2B%2B#2585

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Relacy Rocks...
Date: Fri, 10 Nov 2023 12:44:02 -0800
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <uim4mi$30nss$1@dont-email.me>
References: <uii4a8$23ub9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 10 Nov 2023 20:44:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a600364f4e67105389993083039debad";
logging-data="3170204"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZFrmD1Utj5IHX6DCKP0Mo5mOpYQ435vY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:W4G0ONoUsW9RnNupLDObtDa+afE=
Content-Language: en-US
In-Reply-To: <uii4a8$23ub9$1@dont-email.me>
 by: Chris M. Thomasson - Fri, 10 Nov 2023 20:44 UTC

On 11/9/2023 12:12 AM, Chris M. Thomasson wrote:
> Fwiw, I needed to get back into Relacy. Wrt Bonita, here is a Relacy
> test unit for an old acquaintance of mine, Alex from over on
> comp.programming.threads many years ago. A test of one of his fast
> mutexes for windows, the code is used in:
>
> Take notice that Relacy can model windows sync primitives, and C++...
>
> rl::rl_HANDLE, rl_CreateEvent, ect, and such... ;^)
>
>
> https://github.com/dvyukov/relacy
[...]

Fwiw, you do not need to have windows installed to play around with
Relacy. It simulates windows primitives, and even PThread primitives.

Re: Relacy Rocks...

<uj74u1$2mupb$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2689&group=comp.lang.c%2B%2B#2689

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Relacy Rocks...
Date: Thu, 16 Nov 2023 23:32:17 -0800
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uj74u1$2mupb$2@dont-email.me>
References: <uii4a8$23ub9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 17 Nov 2023 07:32:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e3dfad7c4c93b3524f06016549f1a58c";
logging-data="2849579"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18B3p6QRdfMkouHVzpxFrBvxYepNSril+8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:a7aho7VW0TfB57d7uuvlpzP5aeY=
Content-Language: en-US
In-Reply-To: <uii4a8$23ub9$1@dont-email.me>
 by: Chris M. Thomasson - Fri, 17 Nov 2023 07:32 UTC

On 11/9/2023 12:12 AM, Chris M. Thomasson wrote:
[...]

Almost ready to start work on my new queue. I have my plotter ready, and
it does create volumetric images of some of my experimental fractals. A
low res example at 256^3 volume:

https://i.ibb.co/8XfnmrR/image.png

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor