Jak zrobić pull request w repozytirum Github?

0

Mam kolejne, pewnie proste pytanie. To jest repozytorium Github prof. Lemire:

https://github.com/lemire/testingrng

Zapytał mnie, czy nie zrobiłbym pull request przynajmniej do źródła podkatalog (mojego generatora PRNG). Ale ja nie wiem od czego zacząć.

Jego repozytorium, to jest repozytorium, które testuje popularne generatory liczb pseudolosowych. Ja mam swój kod, wygląda tak:

/* Written in 2023 by Tomasz R. Dziala and Dan Tamir ([email protected]).
 
This is 128-bit Collatz Generator: CG-128. All purpose pseudo random generator,
with excellent statistical quality (it passes all test we aware of) and superb speed.
 
The state may be seeded with any numbers, except c[0], which has to be odd, but we suggest
to seed c[0] by 128-bit odd number and set all other elements equal to zero, for simplicity. 
It is suitable for large-scale parallel computations, since each generator seeded by unike 
odd c[0] produce separate stream of period at least 2^128. 
 
For full independence of 2^64 streams, the first 32 outputs of each stream should be skipped, 
otherwise minor correlations may occur in the first outputs on the low bits of successively 
initialized streams, especially if one initalize streams by numbers 1, 3, 5, ... or other counter. 
For this purpose user may call initalizator(). Using initalizator() every stream may be initialized 
with any 128-bit odd number. If you ever need more than 2^64 independent streams skip first 96 outputs
to get 2^127 independent streams. Skipping the first few outputs is also required to fill all the state
of the generator by bits, however this can be also done by proper choose of the seed. 
 
For faster initialization user may seed a Splitmix64 generator and use its outputs to serially fill c[0]. */
 
#include <cstdint>
 
static __uint128_t c[4] = { 123456789 };
 
__uint128_t next(void)
{
    c[1] = (c[1] >> 1) * ((c[2] += c[1]) | 1) ^ (c[3] += c[0]);
    return c[2] >> 96 ^ c[1];
}
 
/* This is initalizator for the Collatz Generator. It is equivalent to 32 calls to next();
it could be used for initializing independent streams for parallel computations. */
 
void initializator(void)
{
    for (int i = 0; i < 32; i++)
    {
        c[1] = (c[1] >> 1) * ((c[2] += c[1]) | 1) ^ (c[3] += c[0]);
    }
}
 
/* This is Splitmix64 generator written in 2015 by Sebastiano Vigna. The state of Splitmix64
may be seeded with any value. Outputs of Splitmix64 may be used to to serially seed c[0] states
of Collatz Generator. 
 
To fill all the 128-bit state use ((__uint128_t)next_splitmix64() << 64) | next_splitmix64(); */
 
static uint64_t x;
 
uint64_t next_splitmix64() {
	uint64_t z = (x += 0x9e3779b97f4a7c15);
	z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
	z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
	return z ^ (z >> 31);
}

Z tego co patrzę na przykład na kod takiego xoroshiro, który tam jest:

#ifndef XOROSHIRO128PLUS_H
#define XOROSHIRO128PLUS_H

/* Modified by D. Lemire, August 2017 */
#include "splitmix64.h"
#include <stdint.h>

// original documentation by Vigna:
/* This is the successor to xorshift128+. It is the fastest full-period
   generator passing BigCrush without systematic failures, but due to the
   relatively short period it is acceptable only for applications with a
   mild amount of parallelism; otherwise, use a xorshift1024* generator.

   Beside passing BigCrush, this generator passes the PractRand test suite
   up to (and included) 16TB, with the exception of binary rank tests,
   which fail due to the lowest bit being an LFSR; all other bits pass all
   tests. We suggest to use a sign test to extract a random Boolean value.

   Note that the generator uses a simulated rotate operation, which most C
   compilers will turn into a single instruction. In Java, you can use
   Long.rotateLeft(). In languages that do not make low-level rotation
   instructions accessible xorshift128+ could be faster.

   The state must be seeded so that it is not everywhere zero. If you have
   a 64-bit seed, we suggest to seed a splitmix64 generator and use its
   output to fill s. */

// state for xoroshiro128plus
uint64_t xoroshiro128plus_s[2];

static inline uint64_t rotl(const uint64_t x, int k) {
  return (x << k) | (x >> (64 - k));
}

// call this one before calling xoroshiro128plus
static inline void xoroshiro128plus_seed(uint64_t seed) {
  xoroshiro128plus_s[0] = splitmix64_r(&seed);
  xoroshiro128plus_s[1] = splitmix64_r(&seed);
}

// returns random number, modifies xoroshiro128plus_s
static inline uint64_t xoroshiro128plus(void) {
  const uint64_t s0 = xoroshiro128plus_s[0];
  uint64_t s1 = xoroshiro128plus_s[1];
  const uint64_t result = s0 + s1;

  s1 ^= s0;
  xoroshiro128plus_s[0] = rotl(s0, 55) ^ s1 ^ (s1 << 14); // a, b
  xoroshiro128plus_s[1] = rotl(s1, 36);                   // c

  return result;
}

#endif // XOROSHIRO128PLUS_H

To wygląda na to, że powinienem tam dodać taki kod:

#ifndef CG128_H
#define CG128_H

#include "splitmix64.h" /* Lemire ma to w swoim repozytorium, więc użyję splitmixa do zasiania mojego generatora, zamiast kombinować z tworzeniem splitmixa w moim kodzie */

static __uint128_t CG128_c[4];

// call this one before calling CG128
static inline void CG128_seed(uint64_t seed) {
  CG128_c[0] = ((__uint128_t)splitmix64_r(&seed) << 64) | (splitmix64_r(&seed) | 1);
}

static inline __uint128_t CG128(void)
{
    CG128_c[1] = (CG128_c[1] >> 1) * ((CG128_c[2] += CG128_c[1]) | 1) ^ (CG128_c[3] += CG128_c[0]);
    return CG128_c[2] >> 96 ^ CG128_c[1];
}

#endif // CG128_H

Jak coś takiego dodam, to będzie "ok"? Nigdy nie miałem wcześniej styczności z Githubem i pomimo, że ściągnąłem to jego repozytorium i nawet uruchomiłem testy prędkości, to nie wiem jak ono działa.

0

A kod ma cokolwiek wspólnego z GH ?
Próbuję czytać twqoje intencje co do pytania i nie rozumiem

1

Nigdy nie miałem wcześniej styczności z Githubem

Az wyszukiwarką internetową miałeś?

Zerknąłem na dotychczasowe, zamknięte Pull Requesty https://github.com/lemire/testingRNG/pulls?q=is%3Apr+is%3Aclosed. Wychodzi na to, że Pan Lemire życzy sobie robić pull requesty z uprzednio zrobionego forka.

Tak więc jak się robi forka https://docs.github.com/en/get-started/quickstart/fork-a-repo
Jak się robi PR z forka https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork

2

Myślałem, że od razu się robi pull request.

Członkowie jednego zespółu korzystający ze wspólnego repo mogą robić pull requesty w obrębie jednego repozytorium, jeśli mają wystawione pozwolenie przez właściciela repo. Jeśli chodzi jednak o prywatne repozytoria, to ludzie jednak nie chcą się bawić w wystawianie pozwoleń na modyfikowanie swojego osobistego repo tak więc robi się Pull Requesta z forka. Robią też tak i większe projekty, żeby utrzymać porządek, np. https://github.com/qgis/QGIS#new-features-and-enhancements.

1 użytkowników online, w tym zalogowanych: 0, gości: 1