/usr/include/primesieve/ParallelPrimeSieve.hpp is in libprimesieve7-dev-common 5.7.2+ds-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | ///
/// @file ParallelPrimeSieve.hpp
/// @brief The ParallelPrimeSieve class provides an easy API for
/// multi-threaded prime sieving.
///
/// Copyright (C) 2016 Kim Walisch, <kim.walisch@gmail.com>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///
#ifndef PARALLELPRIMESIEVE_HPP
#define PARALLELPRIMESIEVE_HPP
#include "PrimeSieve.hpp"
#include <stdint.h>
namespace primesieve {
/// ParallelPrimeSieve sieves primes in parallel using OpenMP. It
/// is derived from PrimeSieve so it has the same API.
///
class ParallelPrimeSieve : public PrimeSieve
{
public:
/// Used for inter-process communication with the
/// primesieve GUI application.
struct SharedMemory
{
uint64_t start;
uint64_t stop;
uint64_t counts[6];
double status;
double seconds;
int flags;
int sieveSize;
int threads;
};
ParallelPrimeSieve();
virtual ~ParallelPrimeSieve() { }
void init(SharedMemory&);
static int getMaxThreads();
int getNumThreads() const;
int idealNumThreads() const;
void setNumThreads(int numThreads);
using PrimeSieve::sieve;
virtual void sieve();
private:
void* lock_;
SharedMemory* shm_;
int numThreads_;
uint64_t getThreadDistance(int) const;
uint64_t align(uint64_t) const;
template <typename T> T getLock() { return static_cast<T>(lock_); }
virtual double getWallTime() const;
virtual void setLock();
virtual void unsetLock();
virtual bool updateStatus(uint64_t, bool);
};
} // namespace
#endif
|