2013-12-20 55 views
0

我認爲它是一個簡單的問題,因爲我的nvcc實際上工作。但等離子體模擬代碼的配置過程無法識別我的CUDA。 configure.ac文件已附加。我是autoconf的新手,所以我不知道如何調試問題。例如,我在.ac文件中看到了AS_IF(測試「$ enable_cuda」=「yes」),但我不知道如何查看測試結果。誰能幫我這個?謝謝!./configure從另一個應用程序無法識別我的CUDA環境(Ubuntu12.10)

對不起,我太新了,不能附上configure summary截圖,我會輸入那些關鍵部分。

C Compiler: mpicc -std=gnu99 
CFLAGS: -g -02 -Wall 
Fortran Compiler: mpif90 
FFLAGS: -g -02 
CUDA Compiler: 
CUDACFLAGS: 
CUDALIBS: 
LDFLAGS: 

下面是configure.ac代碼。

#            -*- Autoconf -*- 
# Process this file with autoconf to produce a configure script. 

AC_PREREQ(2.59) 
AC_INIT([psc], [1.94]) 
AM_INIT_AUTOMAKE([foreign subdir-objects]) 
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 
AC_CONFIG_HEADERS([config.h]) 
AC_CONFIG_MACRO_DIR([m4]) 

dnl Source any special site-specific file 
hname="`hostname`" 
while test -n "$hname"; do 
    file=$srcdir/src/libmrc/config/host-$hname 
    AC_MSG_CHECKING([for config $file]) 
    if test -f "$file"; then 
    . $file 
    AC_MSG_RESULT([found]) 
    break 
    fi 
    AC_MSG_RESULT([no]) 

    hname2="`echo $hname | tr -d '0-9'`" 
    file=$srcdir/src/libmrc/config/host-$hname2 
    AC_MSG_CHECKING([for config $file]) 
    if test -f "$file"; then 
    . $file 
    AC_MSG_RESULT([found]) 
    break 
    fi 
    AC_MSG_RESULT([no]) 

    hname_tmp=$hname 
    hname="`echo $hname | cut -d. -f2-99`" 
    test "$hname_tmp" = "$hname" && break 
done 

# Check for (MPI) compilers 

AC_PROG_CC([openmpicc mpicc]) 
m4_ifdef([AC_PROG_CC_C99], 
    [AC_PROG_CC_C99], 
    [AC_MSG_WARN([Assuming $CC is gcc!]) 
      CC="$CC -std=gnu99"]) 
if test -z "$CC" || test "X$CC" = "Xno"; then 
    AC_MSG_ERROR([No suitable C99 compiler found]) 
fi 
AM_PROG_CC_C_O 

AC_PROG_CXX([openmpicxx mpicxx]) 

# add -Wall if possible 
AX_CHECK_COMPILER_FLAGS([-Wall], [CFLAGS="$CFLAGS -Wall"]) 

AC_PROG_F77([openmpif90 mpif90]) 

AC_F77_WRAPPERS 
AC_F77_LIBRARY_LDFLAGS 
LIBS="$LIBS $FLIBS" 

# Check for libtool 

dnl LT_INIT([disable-shared]) 
AC_DISABLE_SHARED 
AC_PROG_LIBTOOL 

# Checks for header files. 

# Checks for typedefs, structures, and compiler characteristics. 

# Checks for library functions. 

AX_CHECK_HDF5 
CFLAGS="$H5_CFLAGS $CFLAGS" 
LIBS="$H5_LIBS $LIBS" 
AS_IF([test "$have_hdf5" != "no"], 
     [AC_DEFINE([HAVE_HDF5], [], [we have HDF5 library + headers])]) 
AM_CONDITIONAL([HAVE_HDF5], [test "$have_hdf5" != "no"]) 

# check for PAPI 
AC_ARG_WITH([papi],AS_HELP_STRING([--without-papi], [Disable PAPI])) 

have_papi=no 
AS_IF([test "x$with_papi" != "xno"], 
    [AC_CHECK_HEADER([papi.h], 
    [AC_CHECK_LIB([papi], [PAPI_library_init], 
     [have_papi=yes 
     AC_DEFINE([HAVE_LIBPAPI], [], [we have PAPI library + headers]) 
     LIBS="-lpapi $LIBS"]) 
    ]) 
    ]) 

AS_IF([test "x$have_papi" != "xyes"], 
    [AS_IF([test "x$with_papi" = "xyes"], 
    [AC_MSG_ERROR([PAPI requested but not found.])]) 
    ]) 

# Checks for options 

AC_ARG_VAR([CUDACC], [CUDA compiler]) 
AC_ARG_VAR([CUDACFLAGS], [flags to pass to the CUDA compiler]) 
AC_ARG_VAR([CUDALIBS], [libraries needed to link CUDA code]) 

AH_TEMPLATE([USE_CUDA], [use nvcc to create CUDA code]) 
AC_ARG_ENABLE(
    [cuda], 
    [AS_HELP_STRING([--enable-cuda], [use nvcc to create CUDA code])], 
    [AS_IF([test "$enable_cuda" = "yes"], 
    [AC_DEFINE([USE_CUDA]) 
    AS_IF([test -z "$CUDACC"], 
      [CUDACC=/usr/local/cuda/bin/nvcc]) 
    AS_IF([test -z "$CUDALIBS"], 
      [CUDALIBS="-L/usr/local/cuda/lib -lcudart"]) 
    AC_SUBST([CUDACC]) 
    CUDACFLAGS="$CUDACFLAGS -m64" 
    AC_SUBST([CUDACFLAGS]) 
    CUDAMPIFLAGS="" 
    for dir in `$CC -showme:incdirs`; do 
     CUDAMPIFLAGS="$CUDAMPIFLAGS -I$dir" 
    done 
    AC_SUBST([CUDAMPIFLAGS]) 
    LIBS="$LIBS $CUDALIBS"]) 
    ] 
) 
AM_CONDITIONAL([USE_CUDA], [test "$enable_cuda" = "yes"]) 

AH_TEMPLATE([USE_SSE2], [use streaming SIMD extension 2]) 
AC_ARG_ENABLE(
    [sse2], 
    [AS_HELP_STRING([--enable-sse2], 
        [use code optimized for processors using Intel's SSE2])], 
) 
AS_IF(
[test "$enable_sse2" = "yes"], 
[AC_DEFINE([USE_SSE2]) 
    CFLAGS="$CFLAGS -msse4.1"]) 
AM_CONDITIONAL([USE_SSE2], [test "$enable_sse2" = "yes"]) 

AH_TEMPLATE([CELLEMU], [emulate Cell BE for testing]) 
AC_ARG_ENABLE(
    [cellemu], 
    [AS_HELP_STRING([--enable-cellemu], [pretend we have a Cell Broadband Engine])], 
    [AC_DEFINE([CELLEMU])] 
) 
AM_CONDITIONAL([CELLEMU], [test "$enable_cellemu" = "yes"]) 

AC_CHECK_LIB([spe2], [spe_context_create]) 

AH_TEMPLATE([USE_CBE], [use spu-cc to create Cell BE code]) 
AC_ARG_ENABLE(
    [cbe], 
    [AS_HELP_STRING([--enable-cbe], [use code optimized for the Cell Broadband Engine])], 
) 
AS_IF(
[test "$enable_cbe" = "yes"], 
    [AC_DEFINE([USE_CBE])] 
) 
AM_CONDITIONAL([USE_CBE], [test "$enable_cbe" = "yes"]) 


AH_TEMPLATE([FIELDS_BASE], [base data structure for storing fields]) 
AC_ARG_VAR([FIELDS_BASE], [base data structure for storing fields]) 
AS_IF(
    [test -z "$FIELDS_BASE"], 
    [FIELDS_BASE="FIELDS_C"] 
) 
AC_DEFINE_UNQUOTED([FIELDS_BASE], $FIELDS_BASE) 

AH_TEMPLATE([PARTICLES_BASE], [base data structure for storing particles]) 
AC_ARG_VAR([PARTICLES_BASE], [base data structure for storing particles]) 
AS_IF(
    [test -z "$PARTICLES_BASE"], 
    [PARTICLES_BASE="PARTICLES_C"] 
) 
AC_DEFINE_UNQUOTED([PARTICLES_BASE], $PARTICLES_BASE) 

AC_ARG_VAR([MPIRUN], [mpirun command to run tests]) 
AS_IF(
    [test -z "$MPIRUN"], 
    [AS_IF([test "`echo $CC | cut -f1 -d ' '`" = "openmpicc"], 
     [MPIRUN="openmpirun"], 
    [MPIRUN="mpirun"])] 
) 
AC_SUBST([MPIRUN]) 

AC_CONFIG_FILES([Makefile python/Makefile src/Makefile 
      src/tests/Makefile 
      src/include/Makefile 
      src/libpsc/Makefile 
       src/libpsc/psc_balance/Makefile 
       src/libpsc/psc_bnd/Makefile 
       src/libpsc/psc_bnd_particles/Makefile 
       src/libpsc/psc_bnd_photons/Makefile 
       src/libpsc/psc_bnd_fields/Makefile 
       src/libpsc/psc_collision/Makefile 
       src/libpsc/psc_event_generator/Makefile 
       src/libpsc/psc_output_fields_collection/Makefile 
       src/libpsc/psc_output_fields/Makefile 
       src/libpsc/psc_output_particles/Makefile 
       src/libpsc/psc_output_photons/Makefile 
       src/libpsc/psc_diag/Makefile 
       src/libpsc/psc_patchmanager/Makefile 
       src/libpsc/psc_pulse/Makefile 
       src/libpsc/psc_push_fields/Makefile 
       src/libpsc/psc_push_particles/Makefile 
       src/libpsc/psc_push_photons/Makefile 
       src/libpsc/psc_randomize/Makefile 
       src/libpsc/psc_sort/Makefile 
       src/libpsc/fortran/Makefile 
       src/libpsc/sse2/Makefile 
       src/libpsc/cuda/Makefile 
       src/libpsc/cell_be/Makefile 
]) 
AC_CONFIG_SUBDIRS([src/libmrc]) 

AC_OUTPUT 

echo "" 
echo "      Configure Summary" 
echo "      =================" 
echo "" 
echo "Compiling Options:" 
echo "------------------" 
echo "      C Compiler: $CC" 
echo "       CFLAGS: $CFLAGS" 
echo "    Fortran Compiler: $F77" 
echo "       FFLAGS: $FFLAGS" 
echo "     CUDA Compiler: $CUDACC" 
echo "      CUDACFLAGS: $CUDACFLAGS" 
echo "      CUDALIBS: $CUDALIBS" 
echo "      LDFLAGS: $LDFLAGS" 
echo "       LIBS: $LIBS" 
echo "    Shared Libraries: $enable_shared" 
echo "    Static Libraries: $enable_static" 
echo "       MPIRUN: $MPIRUN" 
echo 
+0

什麼是你實際使用的configure命令?只是'./configure'還是你指定了任何開關?如果指定'./configure --enable-cuda',會發生什麼? –

+0

您也可以嘗試使用'./configure --help'這樣的命令在autoconf生成的配置腳本中應該是非常有用的。 –

+0

我明白了。 ./configure --enable-cuda解決了這個問題。非常感謝!!! – Asgard

回答

0

一般來說,./configure --help通常會給與Autoconf生成的配置腳本的有用信息。

在這種情況下,在.AC文件中的下面一行顯示,--enable-cuda是正確的開關:

[AS_HELP_STRING([--enable-cuda], [use nvcc to create CUDA code])], 
相關問題