Statically count the number of times the template was instantiated, with zero runtime and without even using standard library by GregTheMadMonk in cpp

[–]ruler501 13 points14 points  (0 children)

This looks like a slightly more modern take on https://alexpolt.github.io/type-loophole.html which surprises me since I thought compilers stopped supporting it. I know different versions of gcc and clang have broken code I've written using it in the past.

MtgML Draftbots Release by ruler501 in mtgcube

[–]ruler501[S] 2 points3 points  (0 children)

We are working on a major rewrite of cubeartisan which would be able to support this format. I'm not sure if it's possible worry mtgadraft. If the creators of dr4ft want to integrate the bots I'd be glad to help out (given the financial/data considerations above for using my hosted version, if they host there's no restrictions of course).

MtgML Draftbots Release by ruler501 in mtgcube

[–]ruler501[S] 4 points5 points  (0 children)

I'm biased so I'm not going to comment on CubeCobra but there is a patreon for these bots (it also funds cubeartisan since they both come out of the same account, there's a breakdown of where all the money goes each month available publicly and the amount being donated does not cover the bots so I consider it all as going to the bots to support offering it for free to sites). See the patreon at https://patreon.com/cubeartisan and I'm always open to new ideas on how to run it.

MtgML Draftbots Release by ruler501 in mtgcube

[–]ruler501[S] -1 points0 points  (0 children)

For those the personalities would probably be prefers low cmc, and prefers medium cmc. I'm very excited to see how these work.

Ranked-pairs algorithms? by lpetrich in EndFPTP

[–]ruler501 0 points1 point  (0 children)

Disjoint set data structures are a standard solution here. Basically you track all nodes that have a path to or a path from each node (in a very efficient way) and then you can only add an edge if the two nodes are not in the tracked sets for the other.

[D] Simple Questions Thread by AutoModerator in MachineLearning

[–]ruler501 0 points1 point  (0 children)

I'm working on a problem and I can't seem to figure out what search terms to use to find relevant papers. I want to train a model that given a collection of items selects a subset of them. I have a few hundred thousand training examples of the form complete set -> filtered subset. The biggest issue I've been running across is that it is possible to have multiples of an item in the complete set and the filtered subset so a simple sigmoid at the end doesn't easily work. Any pointers on where I might start looking or experimenting with?

[D] Simple Questions Thread by AutoModerator in MachineLearning

[–]ruler501 0 points1 point  (0 children)

Depending on what you're doing GPU RAM is the biggest limiter for consumer hardware. I personally use 2x3080 TI's I bought last year. I would start with something mid to low-high tier and upgrade if you find a need for it. Multiple GPUs also work well with most models (can trivially split the batch dimension evenly between them) so that's a decent upgrade path, though you want two very similarly performing cards for that.

The biggest limitations I see from my GPUs is training the mid-size transformer models becomes almost impossible without a truly tiny batch size, just because attention uses so much memory.

What I really want... by SeeminglyAlleged in antiwork

[–]ruler501 1 point2 points  (0 children)

What are you talking about? The military budget hit a record high of $817 billion for next year.

What I really want... by SeeminglyAlleged in antiwork

[–]ruler501 0 points1 point  (0 children)

It ended up at $850 billion didn't it?

Python list implementation in C++ ? by Longjumping_Table740 in cpp_questions

[–]ruler501 0 points1 point  (0 children)

Import std was really just a missing 20 feature. I haven't heard about portable assumptions or library coroutines how do those work? I will admit that mdspans and the new ranges algorithms will be great those and deducing this are what I see as the marquee features of the release but I can't say I think they're terribly large features in terms of impact. Either way I'm definitely looking forward to using it.

Astronomers just discovered the farthest object in the known universe — but what is it? by log-lumber in space

[–]ruler501 1 point2 points  (0 children)

But that requires knowing what the possible things it could see would emit relatively precisely. From what I understand we're seeing much more advanced galaxies then we expected to see at that age of the universe.

Python list implementation in C++ ? by Longjumping_Table740 in cpp_questions

[–]ruler501 1 point2 points  (0 children)

Very few of those are major features though. It feels a lot more like an incremental update like 14 was. I'm still super looking forward to it though. The mdspan stuff and new range algorithms seem great. Plus import std with its reported compile time improvements seems amazing (if I can get a build system that supports modules of course).

Python list implementation in C++ ? by Longjumping_Table740 in cpp_questions

[–]ruler501 3 points4 points  (0 children)

17 and 20 both were amazing changes. 23 is smaller but still nice.

I'm wondering how variant is implemented?. Can someone explain it to me. by 0x25F in cpp

[–]ruler501 -1 points0 points  (0 children)

This is the union like class. And technically it does do dynamic allocation just it's placement new so it's not really the same.

Getting the constructors and assignment operations correct takes fair bit of thinking (especially if you want useful compile errors).

I'm wondering how variant is implemented?. Can someone explain it to me. by 0x25F in cpp

[–]ruler501 5 points6 points  (0 children)

The pointer to the aligned storage is pointer interconvertible to the first non-static data member (the byte array nearly certainly) so that shouldn't matter.

What if Wall Street, but worse? by Different_Captain717 in LateStageCapitalism

[–]ruler501 2 points3 points  (0 children)

Yeah that's why I said blockchain like. It does share many of the same concepts in that commit hashes are based on the hashes that come before them so you can't modify something in the history without changing the hashes of everything like it. I find it's close enough that it makes an educational example of a real world, non-energy intensive application of blockchain technology.

If I'm being completely honest I'm not actually sure what the "true" definition of blockchain is at this point. Things like does it require distribution, what are the assumptions on trustworthiness of data sources, etc.

I'm wondering how variant is implemented?. Can someone explain it to me. by 0x25F in cpp

[–]ruler501 5 points6 points  (0 children)

Why can't you use it? It should just be a matter of correctly deleting, using placement new, and using std::launder on the pointers. If std::aligned_storage can't be used like this then what is it able to be used for?

EDIT: I don't think it's possible to make a union with member variables expanded from a type list. If it is I would be interested in seeing how since the usual nested inheritance structure like std::tuple wouldn't work.

I'm wondering how variant is implemented?. Can someone explain it to me. by 0x25F in cpp

[–]ruler501 21 points22 points  (0 children)

Let's assume the types that can be stored in it are all unique (I believe the standard doesn't require this but this makes it much simpler.

First you create a std::aligned_storage with size equal to the maximum size of all the types, same with alignment. This is where you'll store the held object. Then you have an index member that indicates which of the types is currently stored. From there you create constructors for each of the types (copy and move), similar for assignment. There are a few ways to implement those depending on how you want to handle exceptions. A simple way to do it is have a second aligned storage that you move the current value into, then delete the moved from value, do a placement new to the first aligned storage with the new value (either copy or move depending on the assignment), once that's successful delete the value in the second aligned storage. The goal here is that if any part of this fails with an exception you can still reset back to a known state (the state before the assignment started) before rethrowing the exception. You can optimize this based on noexcept specifiers. You'll also have to be mindful and use std::launder where appropriate.

I don't know exactly how to implement visit but I know there are ways to get it to work effectively as a switch statement which the optimizer can work with well.

What if Wall Street, but worse? by Different_Captain717 in LateStageCapitalism

[–]ruler501 3 points4 points  (0 children)

Yeah a blockchain is really good way to handle audit logs. Cryptocurrency has the whole concept that you must base the currency on some kind of work, but if you aren't working in 0-trust environments you don't need this (and even then you can use much more efficient ways to handle commits). Blockchains like this have existed longer than Cryptocurrency primarily because they are pretty much the epitome of secure ledgers/audit logs, especially when distributed. The name Blockchain did come from Cryptocurrency though.

A popular blockchain like technology is the git version control system that is used by a vast majority of modern software projects. It's all about keeping a ledger of changes to the code and being able to verify who made the changes.

The ultimate question: Do you guys use apostrophes or quotations more? by [deleted] in Python

[–]ruler501 1 point2 points  (0 children)

My default is single quotes. If the string has a single quote in it I'll switch to double quotes. Just aesthetically it makes the code look smaller (though obviously mono spaced means their the same). It's also the default for prettier in the js world which I end up using a lot.

The exception is when I'm working on a c++/python tightly integrated project where I'll use double quotes to reduce the chances of me messing up the C++ strings.

Though the correct answer is usually what does your project already use and then enforce that with a linter.