How to run dgemms subroutine on mac computer

In summary, the conversation is about a person who wrote a program on their Mac to run the dgemul subroutine for matrix multiplication, but it doesn't recognize the function. They discuss using the accelerate framework and reference manual for help, but it turns out that LAPACK does not have a matrix-multiplication subroutine.
  • #1
missfangula
32
0

Homework Statement



I wrote a program to run the dgemul subroutine on my mac to find the matrix product for matrix a and matrix b, outputted as matrix c, just like the reference manual told me to. Being a mac user, I added the accelerate framework to the file which contain all the lapack stuff, but it does not recognize 'dgemul' as a function. Can someone please enlighten me as to what I am doing wrong? Below is the completed program.

Homework Equations


The Attempt at a Solution



#import <Foundation/Foundation.h>
#include <Accelerate/Accelerate.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

int main ()
{

double a[16] =
{
1.0, 2.0, 3.0, 4.0,
1.0, 2.0, 3.0, 4.0,
1.0, 2.0, 3.0, 4.0,
1.0, 2.0, 3.0, 4.0

};

double b[16] =
{
5.0, 4.0, 3.0, 2.0,
5.0, 4.0, 3.0, 2.0,
5.0, 4.0, 3.0, 2.0,
5.0, 4.0, 3.0, 2.0
};

double c[16] =
{
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0
};

int lda = 4;
int ldb = 4;
char transa = 'N';
char transb = 'N';
int ldc = 4;
int l = 4;
int m = 4;
int n = 4;

dgemul(a, lda, transa, b, ldb, transb, c, ldc, l, m, n);
int i;
for (i=0; i<16; ++i) printf("%5.10f\n", c);


return 0;
}


Thank you!
-miss fangula
 
Physics news on Phys.org
  • #2
sorry, i meant the dgemul subroutine in the title, not dgemms
 
  • #3
I took a quick look at lapack and didn't see a routine called dgemul included.
 
  • #5
what subroutine should i call to do a matrix-matrix product?
 
  • #6

FAQ: How to run dgemms subroutine on mac computer

How do I install the dgemms subroutine on my mac computer?

To install the dgemms subroutine on your mac computer, you will need to download and install a software package such as CLAPACK or LAPACK. These packages include the necessary libraries and headers for dgemms to run. You will also need to make sure that your compiler is compatible with these packages.

What are the system requirements for running dgemms on a mac computer?

The system requirements for running dgemms on a mac computer will vary depending on the specific software package you are using. However, in general, you will need a mac computer with a compatible compiler (such as GCC or Intel Fortran) and enough memory and storage to run the dgemms subroutine.

How do I call the dgemms subroutine in my code?

To call the dgemms subroutine in your code, you will need to include the appropriate header file (such as cblas.h) and link to the necessary libraries. Then, you can use the function call dgemms() with the appropriate parameters to perform matrix multiplication.

Can I run dgemms on multiple cores or processors on my mac computer?

Yes, you can run dgemms on multiple cores or processors on your mac computer by using a parallel programming model such as OpenMP or MPI. These models allow for the distribution of work across multiple cores or processors, potentially improving the performance of dgemms.

Are there any common errors or issues when running dgemms on a mac computer?

One common error when running dgemms on a mac computer is related to compatibility between the compiler and software packages. Make sure to check the compatibility of your compiler and packages before attempting to run dgemms. Additionally, make sure to properly link to the necessary libraries and headers in your code.

Similar threads

Replies
5
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
8
Views
2K
Replies
4
Views
18K
Replies
6
Views
3K
Back
Top