adding makefile
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
project(hpc)
|
project(hpc)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||||
|
|
||||||
find_package(OpenMP)
|
find_package(OpenMP)
|
||||||
|
|
||||||
|
|||||||
5
Makefile
Normal file
5
Makefile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
main: main.cpp
|
||||||
|
g++ -std=c++11 -O3 -fopenmp main.cpp -o main
|
||||||
|
|
||||||
|
qsub: main
|
||||||
|
qsub -q mamba -l walltime=08:00:00 -l nodes=1:ppn=16 -d `pwd` run.sh
|
||||||
74
main.cpp
74
main.cpp
@@ -3,6 +3,8 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#include <omp.h>
|
||||||
|
|
||||||
using Gens=std::vector<int>;
|
using Gens=std::vector<int>;
|
||||||
using Table=std::vector<Gens>;
|
using Table=std::vector<Gens>;
|
||||||
|
|
||||||
@@ -79,6 +81,7 @@ void learn(Table &coset, const std::vector<Gens> &rels,
|
|||||||
while (true) {
|
while (true) {
|
||||||
bool complete = true;
|
bool complete = true;
|
||||||
|
|
||||||
|
#pragma omp parallel for schedule(static, 1) reduction(&:complete)
|
||||||
for (unsigned int r = 0; r < nrels; ++r) {
|
for (unsigned int r = 0; r < nrels; ++r) {
|
||||||
auto &table = reltables[r];
|
auto &table = reltables[r];
|
||||||
const auto &rel = rels[r];
|
const auto &rel = rels[r];
|
||||||
@@ -146,21 +149,64 @@ Table solve_tc(int ngens, const Gens &subgens, const std::vector<Gens> &rels) {
|
|||||||
return cosets;
|
return cosets;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
struct Mult {
|
||||||
auto s = std::chrono::system_clock::now();
|
int from, to, multiplicity;
|
||||||
auto cosets = solve_tc(4, {}, {
|
};
|
||||||
{0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
|
|
||||||
{1, 2, 1, 2, 1, 2},
|
|
||||||
{2, 3, 2, 3, 2, 3},
|
|
||||||
{0, 2, 0, 2},
|
|
||||||
{0, 3, 0, 3},
|
|
||||||
{1, 3, 1, 3},
|
|
||||||
});
|
|
||||||
auto e = std::chrono::system_clock::now();
|
|
||||||
std::chrono::duration<float> diff = e - s;
|
|
||||||
std::cout << diff.count() << "s" << std::endl;
|
|
||||||
|
|
||||||
// pp(cosets);
|
Table mults(std::vector<Mult> ms) {
|
||||||
|
Table res;
|
||||||
|
for (const auto &m : ms) {
|
||||||
|
int N = res.size();
|
||||||
|
res.emplace_back(m.multiplicity * 2, m.to);
|
||||||
|
for (int i = 0; i < m.multiplicity * 2; i += 2) {
|
||||||
|
res[N][i] = m.from;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
Table torus(int res) {
|
||||||
|
return mults({
|
||||||
|
{0, 1, res},
|
||||||
|
{1, 2, 2},
|
||||||
|
{2, 3, res},
|
||||||
|
{0, 2, 2},
|
||||||
|
{0, 3, 2},
|
||||||
|
{1, 3, 2},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* duododeca
|
||||||
|
* mults({
|
||||||
|
* {0, 1, 5},
|
||||||
|
* {1, 2, 3},
|
||||||
|
* {2, 3, 3},
|
||||||
|
* {0, 2, 2},
|
||||||
|
* {0, 3, 2},
|
||||||
|
* {1, 3, 2},
|
||||||
|
* })
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
if (argc < 2) {
|
||||||
|
std::cerr << "REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE" << std::endl;
|
||||||
|
std::cerr << "gimme more ~~tendies~~ arguments" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int N = std::strtol(argv[1], nullptr, 10);
|
||||||
|
|
||||||
|
const Table &rels = torus(N);
|
||||||
|
|
||||||
|
auto s = std::chrono::system_clock::now();
|
||||||
|
auto cosets = solve_tc(4, {}, rels);
|
||||||
|
auto e = std::chrono::system_clock::now();
|
||||||
|
|
||||||
|
std::chrono::duration<float> diff = e - s;
|
||||||
|
size_t order = cosets.size();
|
||||||
|
|
||||||
|
std::cout << N << "," << diff.count() << "," << order << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user