[英]fortran (std2003)conversion of logical to numeric type
我有一些我嘗試編譯的舊程序。 我得到一個錯誤 mask_part和npsortie是 LOGICAL 的 arrays。 我使用 gfortran-7,這是我唯一可以使用的編譯器版本,因為庫是用這個編譯器版本編譯的。 編譯器的參數是 有關如何解決此問題的提示,我將不勝感激。 從文檔中我看到它過去是 ...
[英]fortran (std2003)conversion of logical to numeric type
我有一些我嘗試編譯的舊程序。 我得到一個錯誤 mask_part和npsortie是 LOGICAL 的 arrays。 我使用 gfortran-7,這是我唯一可以使用的編譯器版本,因為庫是用這個編譯器版本編譯的。 編譯器的參數是 有關如何解決此問題的提示,我將不勝感激。 從文檔中我看到它過去是 ...
[英]Using FFTW3 Fortran library in MacOS
嘗試使用 gfortran 和 FFTW3 庫編譯 Fortran 程序時出現以下錯誤。 然而,該程序使用英特爾編譯器 ifort 成功編譯。 錯誤 編譯命令 pois.f90是包含 FFTW3 命令的程序,用於通過傅里葉變換求解泊松方程。 等效的 C 程序也編譯並成功執行。 根據 FFTW3 文 ...
[英]Pointers in Fortran Common Blocks
我對 Fortran 沒有經驗。我試圖在名為“common”的文件中聲明一個 memory 指針,然后在名為“main.f”的文件中為該指針分配 memory,然后從另一個名為“PrintArray”的文件中調用子例程。F”。 整個事情在“PrintArray.f”中出現錯誤。 我該如何糾正這個問題 ...
[英]How do you pass a 2d array to an external function when the precise shape is determined at runtime in C++?
我有一個 c++ 程序,如下所示: 相應的 fortran 程序僅打印數組,如下所示: 當使用gfortran -c testF.f90 && g++ -c testC.cpp && g++ -o test testF.o testC.o -lgfortran &a ...
[英]gfortran 12.2.0 not working on M1 Macbook Air with MacOS Ventura 13.1-arm64
gfortran 不適用於我的 M1 Macbook Air 和 MacOS Ventura 13.1-arm64 當我嘗試編譯任何程序時,例如 我收到以下錯誤消息: 只有 gfortran 似乎會出錯; 我可以使用 gcc 編譯等效的 C 程序。 我嘗試了幾件事: 從 Ventura 13.0 ...
[英]Sum and assign of array is slower in derived types
我正在比較執行求和后以c=a+b的形式賦值兩個 arrays 的性能,在原生 Fortran 類型real和僅包含一個real數組的派生數據類型之間。 class 非常簡單:它包含用於加法和賦值的運算符以及一個析構函數,如下所示: assign子例程包含不同的操作模式,只是為了進行基准測試。 為 ...
[英]How to make a Fortran Makefiles with object files (.o) and a share library (.so)?
我對 Makefile 的世界完全陌生。 我試着按照一些教程來制作我自己的 makefile。 在我發現的示例中,沒有對包含目標文件 (.o) 和共享庫 (.so) 的情況進行處理。 所以,我試圖激發靈感,但我對如何制作 Fortran 聯編文件的理解似乎有所欠缺。 我從一個與我通常在終端上使用的 ...
[英]trouble running make on CBLAS
我正在嘗試構建一個用於ghostjat/np的 BLAS 共享庫無法使make在CBLAS 源代碼上成功運行。 我在 Ubuntu 20 工作站上執行了這些確切的步驟:# create new directory mkdir ~/blas cd ~/blas # fetch and extract ...
[英]ifort and gfortran get different results computing acos(x)
我正在使用 gfortran 和 ifort 編譯一個簡單的 fortran 程序: 為了盡可能精確地比較結果,我打印出變量的位表示,它們是不同的: 變量acos(x)的差異是否正常? 或者如何更改我的 gfortran 編譯選項以使 gfortran 的結果與 ifortran 相同? ...
[英]what's the equivalent compiling options of ifort's "-double-size 128" in gfortran?
我正在編譯一些最初由 ifort 用 gFortran 編譯的程序,現在重寫編譯命令。 原來的ifort編譯命令是: 從那里我寫了 gFortran 命令: 我可以看到-integer-size 64 -real-size 64對於 gFortran 會變成-fdefault-integer-8 ...
[英]How to link a lot of file .mod .o in GCC
我嘗試在沒有 makefile 的情況下使用方程式進行編譯。com gcc 我有一堆 f90 和 lib.a 因為有很多文件,所以我不能像 gfortran *.f90 *.f 這樣使用,所以我正在使用 gfortran -c filename.f90每個都在一個批處理文件中。 這會創建很多 .m ...
[英]Can't compile fortran on MacOS Monterey: ld: unsupported tapi file type '!tapi-tbd' in YAML file
每當我嘗試編譯 fortran 代碼時,我都會遇到錯誤: 通過 inte.net 查看類似問題,我找到的最常見的解決方案是降級 XCode 命令行工具,並重新安裝 gcc,但這些都不起作用。 我嘗試了 CLTools 14.1 和 13.4,我正在通過自制軟件安裝 gcc。 gfortran 版 ...
[英]R package igraph cant install, needed for rstanarm. No gfortran found?
Rstanarm 似乎安裝正常。 但試圖加載: 嘗試安裝 igraph 時,我收到一段很長的文本,結尾如下: 較舊的答案暗示我需要安裝 gfortran,但即使按照此處的說明進行操作: https://masuday.github.io/fortran_tutorial/install_gfor ...
[英]How to install gfortran-7 on Ubuntu 22.04?
我有一個用 FORTRAN 77 編寫的代碼,它只能與gfortran 7一起運行。 我能夠使用sudo apt install gfortran-7 在 Ubuntu 20.04 下的舊計算機上安裝 gfortran 7 。 現在我在Ubuntu 22.04下有一台新電腦,這個命令不再有效: E ...
[英]How can a Fortran program that iterates over an array and distributes the corresponding entries among a set of subroutines be designed efficiently?
我有一個 fortran 子例程,它接收特定類型的大型未排序數組,並且需要調用其他子例程,這些子例程負責根據其中聲明的值之一解析和存儲每個項目。 在我之前的帖子中,我分享了一個程序,它就是這樣做的,但有一些設計缺陷,比如為每個需要解析的類型分配一個大數組並只填寫所需的值,或者調用if (.not. ...
[英]Fortran producing the incorrect answer at the first calculation
這是我部分編寫的fortran代碼。thf(i) = ths(i)*(psi(i)/3.364)**kappa(i) write(*,*) 'first calculation' write(*,*) thF(i),ths(i),psi(i),kappa(i) thf(i)=ths(i)*(psi( ...
[英]Problem with GNU Fortran compiler (gfortran) and random number seeds
我在 Fortran 中寫了一個程序,它使用 RANDOM_NUMBER() 並用 gfortran 編譯,但我注意到生成的隨機數在版本之間不一致。 如果 RANDOM_SEED() 不用於隨機數生成器的種子,則 gfortran 4.4.7(Centos 6 中的默認值)和 gfortran 4. ...
[英]random_seed in gfortran leads to memory leak?
Valgrind 報告使用random_seed例程時仍然可以訪問的塊。 是預期的,是 gfortran 中的錯誤,還是我遺漏了什么? 例如,以下程序在使用gfortran編譯時: rng.f90 導致valgrind的以下報告: gfortran版本:GNU Fortran (GCC) 12 ...
[英]Python ctypes with Fortran, integer arrays contains unwanted 0s
I am new to using ctypes and I am trying to pass a integer array from Python into Fortran, however, in doing so, I can see that in Fortran, my passed ...
[英]Compiler optimization when variables are reused
在對“從矩陣中減去向量”進行基准測試時,我注意到 Fortran 編譯器在我重用變量/代碼時似乎正在執行某種優化。 看起來 arrays 正在從緩存 memory 中重用,但我不確定。 我相信這種優化會導致我的基准測試結果出現差異,並且想確定具體的優化類型,如果可能的話,將其關閉。 例如,在以下比較 ...