相关疑难解决方法(0)

使用Rcpp和OpenMP在R中进行多线程和SIMD矢量化Mandelbrot

作为一个OpenMP&Rcpp性能测试,我想检查我使用最简单和简单的Rcpp+ OpenMP实现来计算R中Mandelbrot集的速度.目前我所做的是:

#include <Rcpp.h>
#include <omp.h>
// [[Rcpp::plugins(openmp)]]

using namespace Rcpp;

// [[Rcpp::export]]
Rcpp::NumericMatrix mandelRcpp(const double x_min, const double x_max, const double y_min, const double y_max,
                         const int res_x, const int res_y, const int nb_iter) {
  Rcpp::NumericMatrix ret(res_x, res_y);
  double x_step = (x_max - x_min) / res_x;
  double y_step = (y_max - y_min) / res_y;
  int r,c;
#pragma omp parallel for default(shared) private(c) schedule(dynamic,1)
  for (r = 0; r < res_y; r++) { …
Run Code Online (Sandbox Code Playgroud)

multithreading simd openmp mandelbrot rcpp

5
推荐指数
2
解决办法
660
查看次数

标签 统计

mandelbrot ×1

multithreading ×1

openmp ×1

rcpp ×1

simd ×1