mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
config for polybench bench selection
This commit is contained in:
@@ -59,8 +59,9 @@ append config {
|
||||
<resource name="RAM" quantum="1024M"/>
|
||||
</start>
|
||||
<start name="hello_gpgpu">
|
||||
<binary name="hello_gpgpu"/>
|
||||
<resource name="RAM" quantum="1024M"/>
|
||||
<config>
|
||||
<config bench="1">
|
||||
<vfs> <dir name="dev"> <log/> <inline name="rtc">2022-07-20 14:30</inline> </dir> </vfs>
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
||||
</config>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <libc/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -12,152 +13,243 @@
|
||||
// bench includes
|
||||
#include "benchmark/benchmark_extern.h"
|
||||
|
||||
|
||||
void testvm_construct(Genode::Env &env)
|
||||
struct hello_gpgpu
|
||||
{
|
||||
// wait for gpgpu construction
|
||||
Libc::with_libc([&] {
|
||||
usleep(5000000);
|
||||
});
|
||||
Genode::Env& env;
|
||||
unsigned int benchConfig;
|
||||
|
||||
// init CL env
|
||||
Genode::log("===Init VM===");
|
||||
const unsigned long size = 0x10000 * 0x1000;
|
||||
cl_genode clg(env, size);
|
||||
clInitGenode(clg);
|
||||
Genode::Attached_rom_dataspace config{env, "config"};
|
||||
|
||||
// test RPCs
|
||||
Genode::log("===Test RPC===");
|
||||
clg.testRPC();
|
||||
|
||||
// run the test and hope the best
|
||||
Genode::log("===Test GPU===");
|
||||
Genode::Heap heap(env.ram(), env.rm());
|
||||
Genode::Allocator_avl alloc(&heap);
|
||||
//const unsigned int size = 0x10000 * 0x1000;
|
||||
Genode::Ram_dataspace_capability ram_cap = env.ram().alloc(size);
|
||||
Genode::addr_t mapped_base = env.rm().attach(ram_cap);
|
||||
alloc.add_range(mapped_base, size);
|
||||
run_gpgpu_test(alloc);
|
||||
void handle_config()
|
||||
{
|
||||
Genode::log("Reading benchmark config...");
|
||||
config.update();
|
||||
|
||||
// run 2mm
|
||||
Genode::log("===Run PolyBench===");
|
||||
Libc::with_libc([&] {
|
||||
Genode::log("===Run 2mm===");
|
||||
ns_2mm::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run 3mm===");
|
||||
ns_3mm::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run atax===");
|
||||
ns_atax::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run bicg===");
|
||||
ns_bicg::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run doitgen===");
|
||||
ns_doitgen::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run gemm===");
|
||||
ns_gemm::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run gemver===");
|
||||
ns_gemver::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run gesummv===");
|
||||
ns_gesummv::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run mvt===");
|
||||
ns_mvt::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run syr2k===");
|
||||
ns_syr2k::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run syrk===");
|
||||
ns_syrk::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
if (!config.valid()) {
|
||||
Genode::log("Config is invalid!");
|
||||
return;
|
||||
}
|
||||
|
||||
/*Genode::log("===Run gramschmidt===");
|
||||
ns_gramschmidt::main(0, 0); // this one is broken (div by 0 and unsolvable input instance) (official Linux version is broken too!)
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR*/
|
||||
Genode::log("===Run lu===");
|
||||
ns_lu::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
benchConfig = config.xml().attribute_value("bench", (unsigned int)0); // => no benchmark
|
||||
Genode::log("benchConfig: ", benchConfig);
|
||||
}
|
||||
|
||||
Genode::log("===Run correlation===");
|
||||
ns_correlation::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run covariance===");
|
||||
ns_covariance::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::Signal_handler<hello_gpgpu> config_handler {
|
||||
env.ep(), *this, &hello_gpgpu::handle_config
|
||||
};
|
||||
|
||||
Genode::log("===Run adi===");
|
||||
ns_adi::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run convolution_2d===");
|
||||
ns_convolution_2d::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run convolution_3d===");
|
||||
ns_convolution_3d::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run fdtd_2d===");
|
||||
ns_fdtd_2d::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run jacobi_1d_imper===");
|
||||
ns_jacobi_1d_imper::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
Genode::log("===Run jacobi_2d_imper===");
|
||||
ns_jacobi_2d_imper::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
});
|
||||
void run()
|
||||
{
|
||||
// init CL env
|
||||
Genode::log("===Init VM===");
|
||||
const unsigned long size = 0x10000 * 0x1000;
|
||||
cl_genode clg(env, size);
|
||||
clInitGenode(clg);
|
||||
|
||||
Genode::log("===End===");
|
||||
Genode::log("hello gpgpu completed");
|
||||
}
|
||||
// test RPCs
|
||||
Genode::log("===Test RPC===");
|
||||
clg.testRPC();
|
||||
|
||||
// run the test and hope the best
|
||||
Genode::log("===Test GPU===");
|
||||
Genode::Heap heap(env.ram(), env.rm());
|
||||
Genode::Allocator_avl alloc(&heap);
|
||||
//const unsigned int size = 0x10000 * 0x1000;
|
||||
Genode::Ram_dataspace_capability ram_cap = env.ram().alloc(size);
|
||||
Genode::addr_t mapped_base = env.rm().attach(ram_cap);
|
||||
alloc.add_range(mapped_base, size);
|
||||
run_gpgpu_test(alloc);
|
||||
|
||||
// run selected benchmarks
|
||||
Genode::log("===Run PolyBench===");
|
||||
Libc::with_libc([&] {
|
||||
if(benchConfig & (0x1 << 0))
|
||||
{
|
||||
Genode::log("===Run 2mm===");
|
||||
ns_2mm::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 1))
|
||||
{
|
||||
Genode::log("===Run 3mm===");
|
||||
ns_3mm::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 2))
|
||||
{
|
||||
Genode::log("===Run atax===");
|
||||
ns_atax::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 3))
|
||||
{
|
||||
Genode::log("===Run bicg===");
|
||||
ns_bicg::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 4))
|
||||
{
|
||||
Genode::log("===Run doitgen===");
|
||||
ns_doitgen::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 5))
|
||||
{
|
||||
Genode::log("===Run gemm===");
|
||||
ns_gemm::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 6))
|
||||
{
|
||||
Genode::log("===Run gemver===");
|
||||
ns_gemver::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 7))
|
||||
{
|
||||
Genode::log("===Run gesummv===");
|
||||
ns_gesummv::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 8))
|
||||
{
|
||||
Genode::log("===Run mvt===");
|
||||
ns_mvt::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 9))
|
||||
{
|
||||
Genode::log("===Run syr2k===");
|
||||
ns_syr2k::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 10))
|
||||
{
|
||||
Genode::log("===Run syrk===");
|
||||
ns_syrk::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
|
||||
if(benchConfig & (0x1 << 11))
|
||||
{
|
||||
Genode::log("===Run gramschmidt===");
|
||||
ns_gramschmidt::main(0, 0); // this one is broken (div by 0 and unsolvable input instance) (official Linux version is broken too!)
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 12))
|
||||
{
|
||||
Genode::log("===Run lu===");
|
||||
ns_lu::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
|
||||
if(benchConfig & (0x1 << 13))
|
||||
{
|
||||
Genode::log("===Run correlation===");
|
||||
ns_correlation::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 14))
|
||||
{
|
||||
Genode::log("===Run covariance===");
|
||||
ns_covariance::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
|
||||
if(benchConfig & (0x1 << 15))
|
||||
{
|
||||
Genode::log("===Run adi===");
|
||||
ns_adi::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 16))
|
||||
{
|
||||
Genode::log("===Run convolution_2d===");
|
||||
ns_convolution_2d::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 17))
|
||||
{
|
||||
Genode::log("===Run convolution_3d===");
|
||||
ns_convolution_3d::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 18))
|
||||
{
|
||||
Genode::log("===Run fdtd_2d===");
|
||||
ns_fdtd_2d::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 19))
|
||||
{
|
||||
Genode::log("===Run jacobi_1d_imper===");
|
||||
ns_jacobi_1d_imper::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
if(benchConfig & (0x1 << 20))
|
||||
{
|
||||
Genode::log("===Run jacobi_2d_imper===");
|
||||
ns_jacobi_2d_imper::main(0, 0);
|
||||
#ifdef USE_STUPID_ALLOCATOR
|
||||
clg.reset();
|
||||
#endif // USE_STUPID_ALLOCATOR
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Genode::log("===End===");
|
||||
Genode::log("hello gpgpu completed");
|
||||
}
|
||||
|
||||
hello_gpgpu(Genode::Env &e) : env(e), benchConfig(0)
|
||||
{
|
||||
config.sigh(config_handler);
|
||||
handle_config();
|
||||
}
|
||||
};
|
||||
|
||||
void Libc::Component::construct(Libc::Env& env)
|
||||
{
|
||||
testvm_construct(env);
|
||||
static hello_gpgpu hg(env);
|
||||
hg.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user